Elaticsearch第二篇 ELK日志系统7.7.0 Linux安装ES

一、

1、下载上传 sudo rz -be

2、tar zxvf elasticsearch-7.7.0-linux-x86_64.tar.gz 

3、cd elasticsearch-7.7.0/conf/

4、vim elasticsearch.yml 修改配置文件,在最下面加入如下几行:

network.host: 0.0.0.0
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"

4、 ./elasticsearch

后台运行 ./elasticsearch -d

5、检查curl 127.0.0.1:9200

netstat -tunlp|grep 9200

-------------------------

ps -ef | grep elastic

kill -9 进程

后台运行

./elasticsearch -d

帮助

./elasticsearch -h

问题一:如果 ./elasticsearch报错。显示 cause by boot ,no access elaticsearch.yml

 sudo chown -R 用户名:用户组 -R elasticsearch-7.7.0/
问题二:[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决方案:https://blog.csdn.net/jiankunking/article/details/65448030

问题三:java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed

在所有节点的elasticsearch.yml配置文件中加入:

  bootstrap.memory_lock: false

  bootstrap.system_call_filter: false

 

里面内容

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"

 

问题:centos6 如果出现报错

system call filters failed to install; check the logs and fix your configuration or disable system c

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

解决方案:https://blog.csdn.net/qq1137623160/article/details/78341996

 

二、

1、下载上传 sudo rz -be

2、 tar zxvf logstash-7.7.0.tar.gz 

3、 cd logstash-7.7.0/
4、vim first.conf 

输入内容

input {
  tcp {
    mode => "server"
    host => "0.0.0.0"
    port => 5044
    codec => json_lines
  }
}

# 输出到本机的 ES
output {
  stdout{
    codec => rubydebug
  }
 elasticsearch {
hosts => [ "localhost:9200"  ]
index => "web-server-log-%{+YYYY.MM.dd}"   

}

}

 

5、sudo bin/logstash -f first.conf --config.reload.automatic

成功启动

 

后台运行

sudo nohup bin/logstash -f first.conf --config.reload.automatic &

 

【2020年12月7日】

问题一:

如果是空白页面,kibana没有显示出来日志。多半是这个问题,重新启动上面的命令。并看是否有日志过来并打印出来。

tail -100f nohup.out  看是否有JSON日志过来

问题二:

还是白屏。看日志,logstash里面的nohup.out

 Retrying individual bulk actions that failed or were rejected by the previous bulk request. {:count

[2020-12-07T16:07:00,704][INFO ][logstash.outputs.elasticsearch][main][d9ba64b95e8e7dfc55f52be4521e73f00c17bad0010b6b550ff314f26d6cfe5a] retrying failed action with response code: 429 ({"type"=>"cluster_block_exception", "reason"=>"index [web-server-log-2020.12.07] blocked by: [TOO_MANY_REQUESTS/12/index read-only / allow delete (api)];"})

好多这种报错。

解决:是因为磁盘95%以上。

换到data目录的磁盘就好了
 

--------------------------

ps -ef|grep logstash
kill -9 进程

帮助文档:./logstash --help

 

问题三:2021年1月15日

/data/elk/logstash-7.7.0/bin

tail -1000f nohup.out 可以看日志是否正常输出

 

问题四:2021年3月12日

Validation Failed: 1: this action would add [1] total shards, but this cluster currently has [1000]

参考链接:https://blog.csdn.net/weixin_42697074/article/details/104357248

 
PUT /_cluster/settings
{
  "transient": {
    "cluster": {
      "max_shards_per_node":10000
    }
  }
}
 

 

 

 

三、Kibana

1、下载上传

2、tar zxvf kibana-7.7.0-linux-x86_64.tar.gz

3、cd kibana-7.7.0-linux-x86_64/

4、cd config/
5、 vim kibana.yml 

 
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: "http://localhost:9200"
kibana.index: ".kibana"

 

 

 

ps -ef | grep node

kill -9 进程

./kibana

后台运行

./kibana &

nohup ./kibana &

 

里面内容

# Kibana is served by a back end server. This setting specifies the port to use.
server.port: 5601

# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "0.0.0.0"

# Enables you to specify a path to mount Kibana at if you are running behind a proxy.
# Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath
# from requests it receives, and to prevent a deprecation warning at startup.
# This setting cannot end in a slash.
#server.basePath: ""

# Specifies whether Kibana should rewrite requests that are prefixed with
# `server.basePath` or require that they are rewritten by your reverse proxy.
# This setting was effectively always `false` before Kibana 6.3 and will
# default to `true` starting in Kibana 7.0.
#server.rewriteBasePath: false

# The maximum payload size in bytes for incoming server requests.
#server.maxPayloadBytes: 1048576

# The Kibana server's name.  This is used for display purposes.
#server.name: "your-hostname"

# The URLs of the Elasticsearch instances to use for all your queries.
elasticsearch.hosts: ["http://localhost:9200"]

# When this setting's value is true Kibana uses the hostname specified in the server.host
# setting. When the value of this setting is false, Kibana uses the hostname of the host
# that connects to this Kibana instance.
#elasticsearch.preserveHost: true

# Kibana uses an index in Elasticsearch to store saved searches, visualizations and
# dashboards. Kibana creates a new index if the index doesn't already exist.
kibana.index: "weblog"

# The default application to load.
#kibana.defaultAppId: "home"

# If your Elasticsearch is protected with basic authentication, these settings provide
# the username and password that the Kibana server uses to perform maintenance on the Kibana
# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which
# is proxied through the Kibana server.
#elasticsearch.username: "kibana"
#elasticsearch.password: "pass"

# Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively.
# These settings enable SSL for outgoing requests from the Kibana server to the browser.
#server.ssl.enabled: false
#server.ssl.certificate: /path/to/your/server.crt
#server.ssl.key: /path/to/your/server.key

# Optional settings that provide the paths to the PEM-format SSL certificate and key files.
# These files are used to verify the identity of Kibana to Elasticsearch and are required when
# xpack.security.http.ssl.client_authentication in Elasticsearch is set to required.
#elasticsearch.ssl.certificate: /path/to/your/client.crt
#elasticsearch.ssl.key: /path/to/your/client.key

# Optional setting that enables you to specify a path to the PEM file for the certificate
# authority for your Elasticsearch instance.
#elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ]

# To disregard the validity of SSL certificates, change this setting's value to 'none'.
#elasticsearch.ssl.verificationMode: full

# Time in milliseconds to wait for Elasticsearch to respond to pings. Defaults to the value of
# the elasticsearch.requestTimeout setting.
#elasticsearch.pingTimeout: 1500

# Time in milliseconds to wait for responses from the back end or Elasticsearch. This value
# must be a positive integer.
#elasticsearch.requestTimeout: 30000

# List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side
# headers, set this value to [] (an empty list).
#elasticsearch.requestHeadersWhitelist: [ authorization ]

# Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten
# by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration.
#elasticsearch.customHeaders: {}

# Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable.
#elasticsearch.shardTimeout: 30000

# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying.
#elasticsearch.startupTimeout: 5000

# Logs queries sent to Elasticsearch. Requires logging.verbose set to true.
#elasticsearch.logQueries: false

# Specifies the path where Kibana creates the process ID file.
#pid.file: /var/run/kibana.pid

# Enables you specify a file where Kibana stores log output.
#logging.dest: stdout

# Set the value of this setting to true to suppress all logging output.
#logging.silent: false

# Set the value of this setting to true to suppress all logging output other than error messages.
#logging.quiet: false

# Set the value of this setting to true to log all events, including system usage information
# and all requests.
#logging.verbose: false

# Set the interval in milliseconds to sample system and process performance
# metrics. Minimum is 100ms. Defaults to 5000.
#ops.interval: 5000

# Specifies locale to be used for all localizable strings, dates and number formats.
# Supported languages are the following: English - en , by default , Chinese - zh-CN .
#i18n.locale: "en"


 

 

查看文章:https://blog.csdn.net/tanqian351/article/details/83827583

https://www.cnblogs.com/jiongchen/p/12973464.html

https://blog.csdn.net/lidew521/article/details/88091539

https://blog.csdn.net/miss1181248983/article/details/89384990

 

 

 

------------------------------------------------------------------------------------------------------------------------------

问题一:ES启动问题报错1

logback: java.lang.IllegalStateException: Logback configuration error detected:

 

ElasticSearch7.7.0插件es-head安装及使用

参考文章:https://blog.csdn.net/wsdc0521/article/details/106377407

运行命令

npm run start

后台运行

nohup npm run start &
 

----------------------------------------------------------------------------

问题:java.lang.IllegalArgumentException: node settings must not contain any index level settings

去掉这个配置就可以了

https://blog.csdn.net/qq_26684469/article/details/84683424

 

问题:postman创建索引,但head没有显示,可能就是这个没启动

 

 

中文分词:

https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v7.7.0

参考笔记:https://blog.csdn.net/u012211603/article/details/79327326

新建一个ik目录,plugins下面,解压到这下面,重启es,看启动日志

----------------------------------------------------------------------------------------------------------------------------------

1、安装中文分词

curl -H "Content-Type: application/json" -XGET 'http://master:9200/_analyze?pretty=true' -d '{"text":"我们是中国人"}'  curl -H 'Content-Type:application/json' -XGET http://192.168.198.136:9200/_analyze?pretty  -d '{"analyzer": "ik_smart", "text": "我们是中国人"}' 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值