3
votes

I am not sure if elasticsearch is installed in my Mac. macOS: 10.14 elasticsearch: 5.6

This is what I tried:

  1. Bash Command: elasticsearch

    Result: -bash: elasticsearch: command not found

  2. Bash Command: brew search elasticsearch

    Result: ==> Formulae elasticsearch [email protected] [email protected]

  3. Bash Command: brew services start elasticsearch

    Result:

    Service `[email protected]` already started, use `brew services restart [email protected]` to restart.
    
  4. Bash Command: brew services restart [email protected]

    Result:

    ==> Successfully ran `[email protected]` (label: [email protected])
    

But when I tried to curl http://localhost:9200/ I get curl: (7) Failed to connect to localhost port 9200: Connection refused

My app server throws this error: Faraday::ConnectionFailed (Failed to open TCP connection to localhost:9200 (Connection refused - connect(2) for "localhost" port 9200)):

Even when I reinstalled elasticsearch, I am running into this problem again.

Where am I going wrong?

1
Check the log fileShailesh Pratapwar
In logs I could find 'All shards failed', so I manually deleted all shards and reinstalled elasticsearch again, now it works. Thank youLuna Lovegood

1 Answers

3
votes

In logs I could find 'All shards failed' this error.

Running brew info [email protected] I got this:

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

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

Plugins: /usr/local/opt/[email protected]/libexec/plugins/

Config:  /usr/local/etc/elasticsearch/

plugin script: /usr/local/opt/[email protected]/libexec/bin/elasticsearch-plugin

After uninstalling elastic search using brew brew uninstall [email protected]

Manually I checked in all these locations if any of elasticsearch was still present and removed all of it.To make sure that all the old shards gets deleted.

Then I installed elasticsearch again. Now elasticsearch is running smoothly.