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

标签 java elasticsearch homebrew macos-sierra

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

$elasticsearch

我得到输出:

错误:无法找到或加载主类-Xms2g

我调查过:

  1. 我读到这可能是类调用方式的错误?但我没有接触过这样做。这个thread没有帮助,也不是我的问题,因为我没有安装插件。
  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
    
  3. 我也尝试最初通过 manually extracting the .tar.gz package 安装。我一开始遇到了一些 Java 权限被拒绝的错误,但是在运行 chown 来管理自己之后,我也遇到了同样的 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?

最佳答案

请注意 .bashrc 或类似内容中的这一行:

export GREP_OPTIONS='--color=always'

这会破坏许多 shell 的管道,因此许多运行者会在没有给您任何线索的情况下失败。

Ubuntu 等发行版通常默认为系统用户启用此功能。请小心并检查 shell 环境变量。

只需取消设置此变量即可在我的服务器上解决此问题。

关于java - 无法在 Mac Sierra (10.12.2) 上安装 Elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41149796/

相关文章:

Java - 日期模式匹配

Java读取csv文件并单独列出重复出现的情况

elasticsearch - 使用 PostMan 客户端作为附件将 json 数据索引到 elasticsearch

macos - 使用 Homebrew 在 Mac 上安装 GDB 和所有目标

macos - 特使 - 断言失败 : interface_index == 0

terminal - bash_completion 在终端中导致 'command not found'

Java 位运算(基数排序)

java - 错误“svn :SSLv3 SSLContext not available on RAD 7. 5

windows - NXLog和旧的Windows事件

java - Elasticsearch Java API - 构建查询