无法在 Mac Sierra (10.12.2) 上安装 Elasticsearch

wri*_*mus 0 java homebrew elasticsearch macos-sierra

尝试通过以下方式启动 Elasticsearch 5.1.1 时

$ elasticsearch

我得到输出:

Error: Could not find or load main class -Xms2g

我调查过:

  1. 我读到它可能是如何调用类的错误?但我不会这样做。这个线程没有帮助,也不是我的问题,因为我没有安装插件。
  2. 我是通过 Homebrew 安装的。这是其中的一些输出:

    $ brew info elasticsearch
    elasticsearch: stable 5.1.1, HEAD
    Distributed search & analytics engine
    https://www.elastic.co/products/elasticsearch
    Conflicts with: elasticsearch@1.7, elasticsearch@2.4
    /usr/local/Cellar/elasticsearch/5.1.1 (98 files, 35.2M) *
      Built from source on 2016-12-14 at 09:23:56
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/elasticsearch.rb
    ==> Requirements
    Required: java >= 1.8 ?
    ==> Caveats
    Data:    /usr/local/var/elasticsearch/elasticsearch_GabbAHH/
    Logs:    /usr/local/var/log/elasticsearch/elasticsearch_GabbAHH.log
    Plugins: /usr/local/Cellar/elasticsearch/5.1.1/libexec/plugins/
    Config:  /usr/local/etc/elasticsearch/
    plugin script: /usr/local/Cellar/elasticsearch/5.1.1/libexec/bin/plugin
    
    To have launchd start elasticsearch now and restart at login:
      brew services start elasticsearch
    Or, if you don't want/need a background service you can just run:
      elasticsearch
    
    $ brew doctor
    Please note that these warnings are just used to help the Homebrew maintainers
    with debugging if you file an issue. If everything you use Homebrew for is
    working fine: please don't worry and just ignore them. Thanks!
    Warning: You have unlinked kegs in your Cellar
    Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
    those kegs to fail to run properly once built. Run `brew link` on these:
      mongodb
      ruby
    
    Run Code Online (Sandbox Code Playgroud)
  3. 我还尝试通过手动解压缩 .tar.gz 包来进行最初的安装。起初我得到了一些 Java 权限被拒绝的错误,但是在chown为自己运行一个to admin 之后,我也遇到了同样Error: Could not find or load main class类型的错误。

  4. 我刚刚将我的 Java JDK 更新到最新版本:1.8.0_112 并相应地将我的 JAVA_HOME 变量设置为该目录。

  5. Elasticsearch 2 (2.4.3) 的最新版本有效。与此同时,Elasticsearch v5.0.2 失败了。

我该怎么做才能在 Mac 上正确安装 Elasticsearch?

小智 5

注意 .bashrc 或类似文件中的这一行:

出口 GREP_OPTIONS='--color=always'

这将破坏许多炮弹管道,因此许多跑步者将在不给您任何线索的情况下失败。

默认情况下,Ubuntu 发行版通常为系统用户提供此功能。小心并检查该 shell 环境变量。

这个问题在我的服务器上解决了,只是取消了这个变量。