Brew显示Elasticsearch服务器正在运行,但对Elasticsearch服务器的请求不断失败

时间:2019-02-25 05:58:13

标签: bash macos elasticsearch

我不确定Mac中是否安装了elasticsearch。 macOS:10.14 elasticsearch:5.6

这是我尝试过的:

  1. Bash命令: elasticsearch

    结果: -bash: elasticsearch: command not found

  2. Bash命令: brew search elasticsearch

    结果: ==> Formulae elasticsearch elasticsearch@2.4 elasticsearch@5.6✔

  3. Bash命令: brew services start elasticsearch

    结果:

    Service `elasticsearch@5.6` already started, use `brew services restart elasticsearch@5.6` to restart.
    
  4. Bash命令: brew services restart elasticsearch@5.6

    结果:

    ==> Successfully ran `elasticsearch@5.6` (label: homebrew.mxcl.elasticsearch@5.6)
    

但是当我尝试卷曲http://localhost:9200/时 我得到 curl:(7)无法连接到本地主机端口9200:连接被拒绝

我的应用服务器抛出此错误: Faraday :: ConnectionFailed(无法打开与localhost:9200的TCP连接(连接被拒绝-“ localhost”端口9200的connect(2))):

即使我重新安装了Elasticsearch,我仍然再次遇到这个问题。

我要去哪里了?

1 个答案:

答案 0 :(得分:1)

在日志中,我可以找到“所有分片失败”的错误。

运行brew info elasticsearch@5.6 我知道了:

Data:    /usr/local/var/elasticsearch/elasticsearch_suryapandian/

Logs:    /usr/local/var/log/elasticsearch/elasticsearch_suryapandian.log

Plugins: /usr/local/opt/elasticsearch@5.6/libexec/plugins/

Config:  /usr/local/etc/elasticsearch/

plugin script: /usr/local/opt/elasticsearch@5.6/libexec/bin/elasticsearch-plugin

使用brew卸载弹性搜索后 brew uninstall elasticsearch@5.6

我手动检查所有这些位置是否仍然存在任何弹性搜索并将其全部删除。以确保删除所有旧碎片。

然后我再次安装了elasticsearch。现在elasticsearch运行顺利。