Graylog 无法连接到 Kubernetes 集群中的 Elasticsearch

Graylog cannot connect to Elasticsearch in Kubernetes cluster

我在 Kubernetes 集群上部署了 Graylog,一切正常,直到我决定添加环境变量并更新 graylog 部署。

现在,有些东西停止工作了。我可以看到所有输入都是 运行 并且它们正在接受消息:

但是,如果我尝试查看收到的消息,它会出现 returns 500 错误并显示以下消息:

The docs 说 Graylog 容器需要一个名为 elasticsearch

的服务
docker run --link some-mongo:mongo --link some-elasticsearch:elasticsearch -p 9000:9000 -e GRAYLOG_WEB_ENDPOINT_URI="http://127.0.0.1:9000/api" -d graylog2/server

如果我附加到 graylog pod 并卷曲 elasticsearch:9200,我会看到一个成功的结果:

{
  "name" : "Vixen",
  "cluster_name" : "graylog",
  "cluster_uuid" : "TkZtckzGTnSu3JjERQNf4g",
  "version" : {
    "number" : "2.4.4",
    "build_hash" : "fcbb46dfd45562a9cf00c604b30849a6dec6b017",
    "build_timestamp" : "2017-01-03T11:33:16Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.2"
  },
  "tagline" : "You Know, for Search"
}

但是如果 graylog 日志说它正在尝试连接到本地主机:

同样,直到今天一切正常。为什么它尝试连接到本地主机,而不是弹性搜索服务?

您可能想尝试将 elastichost 添加到 graylog.conf

https://github.com/Graylog2/graylog2-server/blob/master/misc/graylog.conf

第 172 行

# List of Elasticsearch hosts Graylog should connect to.
# Need to be specified as a comma-separated list of valid URIs for the http ports of your elasticsearch nodes.
# If one or more of your elasticsearch hosts require authentication, include the    credentials in each node URI that
# requires authentication.
#
# Default: http://127.0.0.1:9200
#elasticsearch_hosts = http://node1:9200,http://user:password@node2:19200

您可以制作自己的 graylog.conf 并将其添加到您的 dockerfile,然后使用它进行构建。

看来是版本问题。我将 graylog 容器降级到以前的稳定版本:2.2.3-1,它又开始工作了。

我的猜测是,当我今天更新图像时,它提取了最新版本,这损坏了一些东西

实际上,Graylog 在 Graylog 2.3 中已经转向 HTTP API。因此,连接Elasticsearch集群的方法发生了变化。您现在可以只提供 ES 节点的 IP 地址,而不是 zen_ping_unicast_hosts。这是更改此设置的提交 - https://github.com/Graylog2/graylog2-server/commit/4213a2257429b6a0803ab1b52c39a6a35fbde889.

这也使我们能够连接 AWS ES 服务,这在以前是不可能的。查看此讨论主题以获得更多见解 - https://github.com/Graylog2/graylog2-server/issues/1473