题 检查服务器状态时出现Elasticsearch 503错误


我一直在使用elasticsearch作为我的Rails应用程序的搜索引擎,但是由于我无法理解的原因它停止了正常工作。当向elasticsearch服务器发出curl请求时,我收到503错误。

curl -XGET http://localhost:9200
{
  "ok" : true,
  "status" : 503,
  "name" : "Killpower",
  "version" : {
    "number" : "0.90.3",
    "build_hash" : "5c38d6076448b899d758f29443329571e2522410",
    "build_timestamp" : "2013-08-06T13:18:31Z",
    "build_snapshot" : false,
    "lucene_version" : "4.4"
  },
  "tagline" : "You Know, for Search"
}

我试图通过重新加载elasticsearch服务并安装新版本来解决问题,但没有任何成功。

这是我在日志中发现的

[2013-09-03 12:31:45,320][INFO ][node                     ] [Killpower] version[0.90.3], 
pid[4222], build[5c38d60/2013-08-06T13:18:31Z]
[2013-09-03 12:31:45,321][INFO ][node                     ] [Killpower] initializing ...
[2013-09-03 12:31:45,327][INFO ][plugins                  ] [Killpower] loaded [], sites []
[2013-09-03 12:31:47,248][INFO ][node                     ] [Killpower] initialized
[2013-09-03 12:31:47,248][INFO ][node                     ] [Killpower] starting ...
[2013-09-03 12:31:47,313][INFO ][transport                ] [Killpower] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/172.20.46.32:9300]}
[2013-09-03 12:31:51,443][INFO ][discovery.zen            ] [Killpower] master_left [[Amphibion][IMB4uACSTyOx3MO2u-FsWg][inet[/fe80:0:0:0:52e5:49ff:fec2:9718%2:9300]]], reason [do not exists on master, act as master failure]
[2013-09-03 12:31:51,446][INFO ][discovery                ] [Killpower] elasticsearch/iavpGrMtRHmWLHMTNpscGQ
[2013-09-03 12:31:51,483][INFO ][http                     ] [Killpower] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/172.20.46.32:9200]}
[2013-09-03 12:31:51,484][INFO ][node                     ] [Killpower] started
[2013-09-03 12:31:54,712][WARN ][transport.netty          ] [Killpower] exception caught on transport layer [[id: 0xa929f24d, /127.0.0.1:50456 => /127.0.0.1:9300]], closing connection

之后也跟着一个很长的java堆栈跟踪。我该如何解决这个问题?


25
2017-09-03 09:40


起源


嗨,你可能想看一下 stackoverflow.com/questions/19793516/... - Mark Huk


答案:


您的本地网络中可能有另一个实例,其中弹性搜索服务器已启动并正在运行。由于elasticsearch中的分片正在从框中工作并且默认启用,因此可能存在主节点冲突。请查看您的elasticsearch.log文件。如果有类似的话

{"error":"MasterNotDiscoveredException[waited for [30s]]","status":503} 

你应该去你的配置文件 /etc/elasticsearch/elasticsearch.yml 并添加此行:

discovery.zen.ping.multicast.enabled: false

29
2018-02-07 14:06





另外检查值

discovery.zen.ping.unicast.hosts

因为有必要发现弹性节点


1
2017-10-23 12:29





安装头,以便您可以更详细地查看状态。我认为当群集无法正常恢复时,503可以出现在状态中,例如丢失/不可恢复的分片

在elasticsearch目录中:

bin/plugin -install mobz/elasticsearch-head

然后在您的浏览器中:

http://127.0.0.1:9200/_plugin/head/

-2
2017-09-03 15:16



如果状态为503,则头插件无法从服务器获取信息。您只能读取日志文件。 - Thomas Decaux