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

时间:2013-09-03 09:40:48

标签: search curl full-text-search elasticsearch tire

我一直在使用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堆栈跟踪。我该如何解决这个问题?

4 个答案:

答案 0 :(得分:30)

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

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

您应该转到配置文件/etc/elasticsearch/elasticsearch.yml并添加以下行:

discovery.zen.ping.multicast.enabled: false

答案 1 :(得分:2)

另外检查

的值
discovery.zen.ping.unicast.hosts

因为有必要发现弹性节点

答案 2 :(得分:0)

就我而言,我在运行Rails服务器的终端上使用代理。禁用代理并重新启动Rails服务器后,问题得以解决。

答案 3 :(得分:-3)

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

在elasticsearch目录中:

bin/plugin -install mobz/elasticsearch-head

然后在浏览器中:

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