Elasticsearch无法在OSX上启动或运行

时间:2016-02-10 11:39:00

标签: macos elasticsearch upgrade

如果他们在Mac上遇到此问题,我希望能帮助他人。我最近使用Homebrew将ES更新为2.2.x分支:

brew uninstall --force elasticsearch
brew update
brew install elasticsearch

我在端口9200上尝试同时尝试localhost和127.0.0.1时出现连接错误。

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

我尝试卸载并加载。

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

然后尝试手动启动。

elasticsearch

出现以下错误,表明Java版本1.7.x是一个错误,以及它无法启动的原因。

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.

在收到此错误后,1.7.x分支上的先前安装的插件也出现了错误。

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.

2 个答案:

答案 0 :(得分:4)

我发现的这些问题的解决方案如下:

  1. 编辑/usr/local/etc/elasticsearch/elasticsearch.yml文件并验证bind_host配置是否已注释,因此默认为0.0.0.0。

  2. 修改/usr/local/Cellar/elasticsearch/YOUR_VERSION/libexec/bin/elasticsearch.in.sh文件并在另一个-XX:-UserSuperWord之后添加JAVA_OPTS标记:

    JAVA_OPTS="$JAVA_OPTS -XX:-UseSuperWord"

  3. 手动删除以前的插件,以便为该ES分支安装最新版本:

    /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

  4. 完成这些步骤后,我可以再次启动ES 2.x然后我可以重新安装任何所需的插件。我希望如果他们遇到类似的问题,这会有所帮助。

答案 1 :(得分:0)

在MacO上遇到此问题,当时我尝试使用homebrew卸载elasticsearch7并安装elastisearch @ 6。 我通过手动删除以下目录并安装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/

步骤:

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