Mike S.
Mike S.

Reputation: 4879

Elasticsearch fails to start or run on OSX

I am posting to hopefully help others if they run into this issue on Mac. I recently updated ES to 2.2.x branch using Homebrew:

brew uninstall --force elasticsearch
brew update
brew install elasticsearch

I repeatedly got connection errors trying both localhost and 127.0.0.1 on port 9200.

curl http://localhost:9200
curl: (7) Failed to connect to localhost port 9200: Connection refused

I tried an unload and load.

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist

Then tried starting manually.

elasticsearch

The following errors appeared indicating that the Java version 1.7.x was an error and why it would not start.

Exception in thread "main" java.lang.RuntimeException: Java version: Oracle Corporation 1.7.0_45 [Java HotSpot(TM) 64-Bit Server VM 24.45-b08] suffers from critical bug https://bugs.openjdk.java.net/browse/JDK-8024830 which can cause data corruption.
Please upgrade the JVM, see http://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html for current recommendations.
If you absolutely cannot upgrade, please add -XX:-UseSuperWord to the JAVA_OPTS environment variable.
Upgrading is preferred, this workaround will result in degraded performance.
    at org.elasticsearch.bootstrap.JVMCheck.check(JVMCheck.java:123)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:283)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.

After getting past this error, there were errors as well for previously-installed plugins on the 1.7.x branch.

Exception in thread "main" java.lang.IllegalStateException: Could not load plugin descriptor for existing plugin [bigdesk]. Was the plugin built before 2.0?
Likely root cause: java.nio.file.NoSuchFileException: /usr/local/var/lib/elasticsearch/plugins/bigdesk/plugin-descriptor.properties
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
    at java.nio.file.Files.newByteChannel(Files.java:315)
    at java.nio.file.Files.newByteChannel(Files.java:361)
    at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:380)
    at java.nio.file.Files.newInputStream(Files.java:106)
    at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:87)
    at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:378)
    at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:128)
    at org.elasticsearch.node.Node.<init>(Node.java:146)
    at org.elasticsearch.node.Node.<init>(Node.java:128)
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.

Upvotes: 4

Views: 6971

Answers (2)

Nandan
Nandan

Reputation: 567

I had this issue on MacOs, when I tried to uninstall elasticsearch7 and install elastisearch@6 using homebrew. I resolved it by manually deleting the following directories and installed elasticsearch@6

Data:    /usr/local/var/lib/elasticsearch/
Logs:    /usr/local/var/log/elasticsearch/elasticsearch_<<user>>.log
Plugins: /usr/local/var/elasticsearch/plugins/
Config:  /usr/local/etc/elasticsearch/

steps:

>brew uninstall elasticsearch
>rm -rf <<above mentioned directories>>
>brew install elasticsearch@6

Upvotes: 0

Mike S.
Mike S.

Reputation: 4879

The solutions to these issues I discovered were the following:

  1. Edit the /usr/local/etc/elasticsearch/elasticsearch.yml file and verify the bind_host configs are commented so it will default to 0.0.0.0.

  2. Edit the /usr/local/Cellar/elasticsearch/YOUR_VERSION/libexec/bin/elasticsearch.in.sh file and add the -XX:-UserSuperWord flag after the other JAVA_OPTS:

    JAVA_OPTS="$JAVA_OPTS -XX:-UseSuperWord"

  3. Manually remove the previous plugins so you can install the latest versions for that ES branch:

    /usr/local/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin list

    Installed plugins in /usr/local/var/lib/elasticsearch/plugins:

    - bigdesk
    - head
    

    /usr/local/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin remove bigdesk /usr/local/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin remove head


After these steps I could once again start ES 2.x and then I can re-install any desired plugins. I hope this helps others if they run into similar issues.

Upvotes: 4

Related Questions