安装Elastic Stack组件(Elasticsearch,Logstash,Kibana,Filebeat)报错锦集

怎甘沉沦 提交于 2020-02-04 05:50:37

报错一:kibana登录出错,查看日志发现:crypt_r() failed

$ cat /var/log/nginx/error.log
2020/01/28 12:11:38 [crit] 8863#8863: *3 crypt_r() failed (22: Invalid argument), client: 10.20.44.113, server: xx.xx.xx.xx, request: "GET /status HTTP/1.1", host: "xx.xx.xx.xx"

原因分析

# 最初创建用户时,我已经犯规了。结果,htpasswd文件如下所示:
$ cat /etc/nginx/htpasswd.users
kibanaadmin:
kibanaadmin:$apr1$sNJR/eWP$4YZjLMfSka13/UfkLH2.J.

解决方法

# 删除空白用户后,一切正常。
$ sudo nano /etc/nginx/htpasswd.users
$ cat /etc/nginx/htpasswd.users
kibanaadmin:$apr1$sNJR/eWP$4YZjLMfSka13/UfkLH2.J.

报错二:安装有filebeat采集日志的服务器上连接elasticsearch失败

Failed to connect to xx.xx.xx.xx port 9200: Connection refused

# 报错详细
$ sudo filebeat setup --template -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=["xx.xx.xx.xx:9200"]'
Exiting: Couldn't connect to any of the configured Elasticsearch hosts. Errors: [Error connection to Elasticsearch http://xx.xx.xx.xx:9200: Get http://xx.xx.xx.xx:9200: dial tcp xx.xx.xx.xx:9200: connect: connection refused]

$ curl -XGET 'http://xx.xx.xx.xx:9200/filebeat-*/_search?pretty'
curl: (7) Failed to connect to xx.xx.xx.xx port 9200: Connection refused

解决方法 :替换elasticsearch 配置文件 中的 localhost为IP

$ sudo nano /etc/logstash/conf.d/30-elasticsearch-output.conf
output {
  elasticsearch {
    hosts => ["xx.xx.xx.xx:9200"]
    manage_template => false
    index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
  }
}

报错三:curl http://xx.xx.xx.xx:5601时报错:Kibana server is not ready yet

报错四:fail to get the Kibana version: HTTP GET request to /api/status fails

报错详细情况

sudo filebeat setup -e -E output.logstash.enabled=false -E output.elasticsearch.hosts=['xx.xx.xx.xx:9200'] -E setup.kibana.host=xx.xx.xx.xx:5601

2020-01-29T10:25:38.245+0800    INFO    instance/beat.go:280    Setup Beat: filebeat; Version: 6.8.6
2020-01-29T10:25:38.246+0800    INFO    elasticsearch/client.go:164     Elasticsearch url: http://xx.xx.xx.xx:9200
2020-01-29T10:25:38.246+0800    INFO    [publisher]     pipeline/module.go:110  Beat name: elk
2020-01-29T10:25:38.246+0800    INFO    elasticsearch/client.go:164     Elasticsearch url: http://xx.xx.xx.xx:9200
2020-01-29T10:25:38.278+0800    INFO    elasticsearch/client.go:739     Attempting to connect to Elasticsearch version 6.8.6
2020-01-29T10:25:38.396+0800    INFO    template/load.go:128    Template already exists and will not be overwritten.
2020-01-29T10:25:38.396+0800    INFO    instance/beat.go:889    Template successfully loaded.
Loaded index template
Loading dashboards (Kibana must be running and reachable)
2020-01-29T10:25:38.396+0800    INFO    elasticsearch/client.go:164     Elasticsearch url: http://xx.xx.xx.xx:9200
2020-01-29T10:25:38.398+0800    INFO    elasticsearch/client.go:739     Attempting to connect to Elasticsearch version 6.8.6
2020-01-29T10:25:38.495+0800    INFO    kibana/client.go:118    Kibana url: http://xx.xx.xx.xx:5601
2020-01-29T10:25:38.495+0800    ERROR   instance/beat.go:906    Exiting: fail to create the Kibana loader: Error creating Kibana client: Error creating Kibana client: fail to get the Kibana version: HTTP GET request to /api/status fails: fail to execute the HTTP GET request: Get **http://xx.xx.xx.xx:5601/api/status: dial tcp xx.xx.xx.xx:5601: connect: connection refused. Response: .**
Exiting: fail to create the Kibana loader: Error creating Kibana client: Error creating Kibana client: fail to get the Kibana version: HTTP GET request to /api/status fails: fail to execute the HTTP GET request: Get http://xx.xx.xx.xx:5601/api/status: dial tcp xx.xx.xx.xx:5601: connect: connection refused. Response: .

解决方法(报错三和报错四):在安装kibanna的服务器上增加以下配置:

$ sudo nano /etc/kibana/kibana.yml
server.port: 5601
server.host: "xx.xx.xx.xx"
elasticsearch.hosts: ["http://xx.xx.xx.xx:9200"]
$ grep ^[a-Z] /etc/kibana/kibana.yml
server.port: 5601
server.host: "xx.xx.xx.xx"
elasticsearch.hosts: ["http://xx.xx.xx.xx:9200"]
# 更改配置文件后,重启
$ sudo systemctl restart kibana
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!