在Ubuntu 12.04上安装ElasticSearch

6

我有一个运行Ubuntu 12.04的虚拟机,并尝试安装ElasticSearch。我按照这个gist的指示进行操作,一切都正常安装 - 包被下载、解压缩、复制到正确的位置等。

问题出现在我运行它时 - 要么通过调用:

$ /usr/local/share/elasticsearch/bin/elasticsearch

或者通过使用服务包装器 ($ rselasticsearch console)

输出被记录在wrapper.log中,如下所示。我认为可能存在JAVA home / classpath问题,但不确定。

非常感谢任何帮助!

Running ElasticSearch...
wrapper  | Unable to write to the configured log directory: /usr/local/share/elasticsearch/logs (No such file or directory)
wrapper  |   The directory does not exist.
wrapper  | Unable to write to the configured log file: /usr/local/share/elasticsearch/logs/service.log (No such file or directory)
wrapper  |   Falling back to the default file in the current working directory: wrapper.log
wrapper  | --> Wrapper Started as Console
wrapper  | Java Service Wrapper Community Edition 32-bit 3.5.14
wrapper  |   Copyright (C) 1999-2011 Tanuki Software, Ltd. All Rights Reserved.
wrapper  |     http://wrapper.tanukisoftware.com
wrapper  | 
wrapper  | Launching a JVM...
jvm 1    | WrapperManager: Initializing...
jvm 1    | WrapperSimpleApp Error: Unable to locate the class org.elasticsearch.bootstrap.ElasticSearchF : java.lang.ClassNotFoundException: org.elasticsearch.bootstrap.ElasticSearchF
jvm 1    | 
jvm 1    | WrapperSimpleApp Usage:
jvm 1    |   java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class{/app_method}} [app_arguments]
jvm 1    | 
jvm 1    | Where:
jvm 1    |   app_class:      The fully qualified class name of the application to run.
jvm 1    |   app_arguments:  The arguments that would normally be passed to the
jvm 1    |                   application.
wrapper  | JVM exited while loading the application.
...
wrapper  | There were 5 failed launches in a row, each lasting less than 300 seconds.  Giving up.
wrapper  |   There may be a configuration problem: please check the logs.
wrapper  | <-- Wrapper Stopped

更新

鉴于我们现在已经进入了2016年,运行ES在Ubuntu上最简单的方法是使用Docker。 docker run elasticsearch将下载最新版本并在前台运行,显然您可以将其作为守护程序运行,或者运行特定版本(例如elasticsearch:1.7.2),并设置端口等。


请确保您也获取了正确的包装器版本,请参阅此处的自述文件(https://github.com/elasticsearch/elasticsearch-servicewrapper)。 - reim
5个回答

12

对于任何尝试我之前所做的事情的人,警告一下 - Gist 中指定的 URL 是源文件版本而不是已编译的版本,因此没有 *.class 文件。

您可以直接使用这个 Gist,但请用 ElasticSearch 网站上最新的下载链接替换目前 Gist 中存在的 GitHub 链接,例如:

....
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
...

** 这是截至2014年5月20日的最新版本。如果想获取更更新的版本,请访问页面,在下载部分中右键单击 TAR 链接,复制链接并替换第一行的 wget 参数。


8

1
Scott - 感谢你更新这个要点 - 我相信人们会发现它很有用。不幸的是,我不能好心地接受你的答案,因为它在我已经回答问题7个小时之后才出现。然而,我会投赞成票的。 - Hugo Rodger-Brown

6

按照以下步骤轻松配置Elastic Search。

第一步 - 安装Java:

$ sudo apt-get update 

$ sudo apt-get install openjdk-7-jre 

$ java -version 

第二步 - 下载和安装Elasticsearch:

$ wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.2.deb 

$ sudo dpkg -i elasticsearch-1.7.2.deb 

$ sudo update-rc.d elasticsearch defaults

第三步 - 配置Elastic:

$ sudo nano /etc/elasticsearch/elasticsearch.yml

node.name: "My First Node" cluster.name: mycluster1

$ sudo service elasticsearch start 

第四步 - 保护Elastic:

$ sudo nano /etc/elasticsearch/elasticsearch.yml 

network.bind_host: localhost

script.disable_dynamic: true

第五步 - 测试:

$ curl -X GET 'http://localhost:9200' 或在任何浏览器中运行 http://localhost:9200。

您应该看到以下响应:

{ 
"status" : 200,
"name" : "Harry Leland",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.7.2",
"build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
"build_timestamp" : "2015-09-14T09:49:53Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}

参考资料:

http://laravelcode.com/post/how-to-install-elastic-search-in-local-system-and-live-server


3

我从elasticsearch网站上下载的deb文件,使用以下命令进行解包安装:

sudo dpkg -i elasticsearch-1.1.1.deb


在Ubuntu 12.04上,v1.2.0同样适用。Upstart脚本可以很好地作为服务运行。 - cleaver

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接