12

I installed elasticsearch by brew install elasticsearch and started it with brew services start elasticsearch, however, curl http://127.0.0.1:9200 shows connection refused. I checked the port: netstat -a -n | grep tcp | grep 9200 and some ipv4 is running there. Ok, so I opened /usr/local/etc/elasticsearch/elasticsearch.yml and changed the port to 9300 and also uncommented and changed: network.host: 127.0.0.1. Still shows connection refused when I do curl http://127.0.0.1:9300. The OS is MacOS High Sierra 10.13.4. If we open /usr/local/var/log/elasticsearch/elasticsearch_nikitavlasenko.log the error seems to be:

Cluster name [elasticsearch_nikitavlasenko] subdirectory exists in data paths [/usr/local/var/lib/elasticsearch/elasticsearch_nikitavlasenko]. All data under these paths must be moved up one directory to paths [/usr/local/var/lib/elasticsearch]

4
  • 1
    No, definitely not. Please, read the first line curl http://localhost:9200 it is working fine. In my case it never did. Besides, as you can see from my question, I already tried setting network.host Mar 31, 2019 at 4:16
  • which version of ES you are using? also can you provide the content of your elasticsearch.yml
    – Amit
    Apr 1, 2019 at 5:09
  • were u able to resole the issue?
    – Amit
    Apr 2, 2019 at 4:07
  • Not yet, going to try it out soon. Apr 2, 2019 at 18:56

3 Answers 3

19

Did you have an older version (2.x or before) installed before? It sounds a lot like this PR to check that you're not using the old behavior when there was the node name in the path.

What I would do:

  • If you don't need the data any more, just remove /usr/local/var/lib/elasticsearch/elasticsearch_nikitavlasenko and start fresh.
  • If you need the data, you could either change path.data in your config or move the folder one level up (just like the log message says).

PS: I wouldn't use port 9300 for HTTP, because that's generally the port used for communication of the nodes in a cluster itself.

1
  • 3
    I had the same issue just now. Turns out that the config file points to /usr/local/var/lib/elasticsearch for the data path, but the package creates the directory /usr/local/var/lib/elasticsearch/elasticsearch_USERNAME. Since that elasticsearch_USERNAME directory is in there, it fails to start. I resolved the error by simply removing the elasticsearch_USERNAME directory as you suggested. Apr 1, 2019 at 8:16
3

This was the result of a bug in the Homebrew formula for Elasticsearch. It was creating a directory with the node name which is no longer allowed for Elasticsearch.

The formula has been updated to remove node name from path.data and no longer create the invalid directory which should resolve this problem.

1

Ran into this issue some time back, Please add a minimal Elastic config file. for me it looks like below

http.port: 9200
discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

path.data: /usr/local/var/elasticsearch/
path.logs: /usr/local/var/log/elasticsearch/
# Set both 'bind_host' and 'publish_host':
network.host: 127.0.0.1

# 1. Disable multicast discovery (enabled by default):
discovery.zen.ping.multicast.enabled: false
script.engine.groovy.inline.aggs: on

I think I wasn't having below config which caused the issue:

network.host: 127.0.0.1

Please check if its there in your config? Also properly set your data and logs folder path.

Let me know if you face any issue and have questions on these configs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.