Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't start ElasticSearch on Mac

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]

like image 496
Nikita Vlasenko Avatar asked Mar 31 '19 04:03

Nikita Vlasenko


People also ask

How do I know if Elasticsearch is running on my Mac?

Checking if Elasticsearch is running on Mac OS X is a simple process. First, open the Terminal application. Then, type the following command and press Enter: ps -A | grep -i elasticsearch. You should see a process with the name [elasticsearch] if Elasticsearch is running.


1 Answers

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.

like image 128
xeraa Avatar answered Sep 18 '22 09:09

xeraa