首页 > 解决方案 > X-Pack 401 Logstash 无法连接到 Elasticsearch

问题描述

重新启动 Elasticsearch 后,我更改了 JVM 堆大小并且 Logstash 无法连接到 Elasticsearch

日志存储.yml

xpack.monitoring.enabled: true
xpack.monitoring.elasticsearch.hosts: ["es:9200"]
xpack.monitoring.elasticsearch.username: logstash_system
xpack.monitoring.elasticsearch.password: pass

Logstash 的日志

[WARN][logstash.outputs.elasticsearch][main] 尝试恢复与死掉的 ES 实例的连接,但出现错误。{:url=>" http://es:9200/ ", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :error=>"得到响应代码 '401' 联系 Elasticsearch在 URL ' http://es:9200/ '"}


使用相同的凭据从 logstash 卷曲到 es

logstash: curl -ulogstash_system es:9200
Enter host password for user 'logstash_system':
{
  "name" : "elasticsearch",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "",
  "version" : {
    "number" : "7.5.0",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "",
    "build_date" : "2019-11-26T01:06:52.518245Z",
    "build_snapshot" : false,
    "lucene_version" : "8.3.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

标签: elasticsearchlogstashelastic-stackhttp-status-code-401elk

解决方案


推荐阅读