尝试通过以下方式启动Elasticsearch 5.1.1时
$ elasticsearch
我得到的输出:
Error: Could not find or load main class -Xms2g
我调查了:

  • 我读到它可能是如何调用类的错误?但是我没有这样做的余地。这个thread没有帮助,并不是我的问题,因为我没有安装插件。
  • 我通过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
    
  • 我也尝试通过manually extracting the .tar.gz package最初进行安装。首先,我遇到了一些Java权限被拒绝的错误,但是在为自己运行chown进行管理之后,我也遇到了同样的Error: Could not find or load main class类型错误。
  • 我刚刚将Java JDK更新为最新版本:1.8.0_112,并相应地将JAVA_HOME变量设置为该目录。
  • 适用于Elasticsearch 2(2.4.3)的最新版本。同时,Elasticsearch v5.0.2失败。

  • 如何在Mac上正确安装Elasticsearch?

    最佳答案

    您的.bash_profile中很可能有问题。通常,在Mac上,elastic是开箱即用的。

    10-07 19:05
    查看更多