简体   繁体   English

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

[英]Graylog cannot connect to Elasticsearch in Kubernetes cluster

I deployed Graylog on a Kubernetes cluster and everything was working fine, until I decided to add an environment variable and update the graylog deployment. 我在Kubernetes集群上部署了Graylog,并且一切正常,直到我决定添加环境变量并更新Graylog部署。

Now, some things stopped working. 现在,有些事情停止了。 I can see that all inputs are running and they are accepting messages: 我可以看到所有输入都在运行,并且它们正在接受消息:

在此处输入图片说明

However, if I try to see the received messages, it returns 500 error with the following message: 但是,如果尝试查看收到的消息,则会返回500错误并显示以下消息:

一种

The docs say that the Graylog container needs a service called elasticsearch 该文档说,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

And if I attach to the graylog pod and curl elasticsearch:9200 , I see a successful result: 并且,如果我连接到graylog pod并卷曲elasticsearch 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"
}

But if the graylog logs say that it is trying to connect to the localhost: 但是,如果Graylog日志说它正在尝试连接到本地主机:

在此处输入图片说明

Again, everything was working to this day. 再次,直到今天一切都在工作。 Why is it trying to connect to the localhost, not the elastic search service? 为什么要尝试连接到本地主机,而不是弹性搜索服务?

Looks like it was a version problem. 看来这是版本问题。 I downgraded the graylog container to the previous stable version: 2.2.3-1 and it started working again. 我将Graylog容器降级到以前的稳定版本:2.2.3-1,它再次开始工作。

My guess is that when I updated the images today, it pulled the latest version which corrupted some things 我的猜测是,当我今天更新图像时,它拉出了损坏某些内容的最新版本

you may want to try add elastichost to graylog.conf 您可能想要尝试将elastichost添加到graylog.conf

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

at line 172 在第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

you can make your own graylog.conf and add this to your dockerfile then build with it. 您可以创建自己的graylog.conf并将其添加到您的dockerfile中,然后使用它进行构建。

Actually, Graylog has shifted to HTTP API in Graylog 2.3. 实际上,Graylog已在Graylog 2.3中转移到HTTP API。 Therefore, the method of connecting to Elasticsearch cluster has changed. 因此,连接到Elasticsearch集群的方法已更改。 You can now just provide the IP addresses of the ES nodes instead of zen_ping_unicast_hosts. 现在,您只需提供ES节点的IP地址即可,而不是zen_ping_unicast_hosts。 This is the commit which changed this setting - https://github.com/Graylog2/graylog2-server/commit/4213a2257429b6a0803ab1b52c39a6a35fbde889 . 这是更改此设置的提交-https: //github.com/Graylog2/graylog2-server/commit/4213a2257429b6a0803ab1b52c39a6a35fbde889

This also enables us to connect AWS ES service as well which was not possible earlier. 这也使我们能够连接以前无法实现的AWS ES服务。 See this thread of discussion to get more insights - https://github.com/Graylog2/graylog2-server/issues/1473 查看此讨论线程以获取更多见解-https: //github.com/Graylog2/graylog2-server/issues/1473

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM