在OSX小牛上安装弹性搜索 [英] Installing Elasticsearch on OSX Mavericks
问题描述
我正在尝试在OSX小牛上安装Elasticsearch 1.1.0,但是当我尝试开始时,我收到以下错误:
I'm trying to install Elasticsearch 1.1.0 on OSX Mavericks but i got the following errors when i'm trying to start:
:> ./elasticsearch
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.Version
at org.elasticsearch.bootstrap.Bootstrap.buildErrorMessage(Bootstrap.java:252)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:236)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
此外,当我使用-v arg执行相同的命令时,我收到这个错误:
Also when i'm executing the same command with -v arg, i got this error:
:> ./elasticsearch -v
Exception in thread "main" java.lang.NoSuchFieldError: LUCENE_36
at org.elasticsearch.Version.<clinit>(Version.java:42)
这是我的环境:
Java版本
>: java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
安装路径(从弹性搜索下载页面下载.tar.gz存档并在此处提取):
Instalation path (downloaded .tar.gz archive from elasticsearch download page and extracted here):
/usr/local/elasticsearch-1.1.0
ENV vars:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
CLASSPATH=/usr/local/elasticsearch-1.1.0/lib/*.jar:/usr/local/elasticsearch-1.1.0/lib/sigar/*.jar
< h2>更新
我终于让它工作了,不幸的是不知道如何我尝试了很多变化:)。但是,这里列出了我可以帮助的更改列表:
UPDATE
i finally make it working, unfortunally not sure how because i tried a lot of changes :). But here's a list of changes i made that can help:
-
我删除了jdk和jre并重新安装在一个干净的环境中。
http://docs.oracle .com / javase / 8 / docs / technotes / guides / install / mac_jdk.html#A1096855
我删除了所有缓存dirs.I假设这可以是它现在工作的原因。
i deleted all the cache dirs.I suppose this can be the 'cause' for that it's working now
〜/ Library / Caches
~/Library/Caches
/ Library / Caches
- 我删除了CLASSPATH env var。
i removed CLASSPATH env var.
ES_PATH和ES_HOME env vars也不设置,但我认为这并不重要。
ES_PATH and ES_HOME env vars are not set either, but i think this is not so important.
注意:现在,如果我正在使用brew进行安装,它也会工作。
Note: now it's working also if i'm installing with brew.
谢谢。
推荐答案
你应该考虑使用冲泡。这是一个很好的工具,它将负责依赖,版本控制等等。
You should really consider using brew. It's a great tool that will take care of dependencies, version control and much more.
要使用brew安装Elasticsearch,只需:
To install Elasticsearch using brew, simply:
brew update
brew install elasticsearch
轰!完成。
之后按照弹性搜索说明:
After that follow Elasticsearch instructions :
-
要有launchd启动Elasticsearch登录时:
To have launchd start Elasticsearch at login:
ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
现在加载弹性搜索:
Then to load Elasticsearch now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
或者,如果你不想/需要launchctl,你可以运行:
Or, if you don't want/need launchctl, you can just run:
elasticsearch
这篇关于在OSX小牛上安装弹性搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!