在Ubuntu 12.04上安装ElasticSearch

时间:2013-01-11 12:18:31

标签: ubuntu elasticsearch ubuntu-12.04

我有一台运行Ubuntu 12.04的虚拟机,我正在尝试安装ElasticSearch。我已经按照gist最好的'学习X艰难的方式'的精神,一切安装得很好 - 包下载,解压缩,复制到正确的地方等。

问题来自于我运行它 - 通过调用:

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

或使用服务包装器($ rselasticsearch console

输出记录到wrapper.log,包含在下面。我认为我可能有JAVA家庭/类路径问题,但我不确定。

最感激的任何帮助!

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年,在Ubuntu上运行ES的最简单方法是使用Docker。 docker run elasticsearch将下载最新版本并在前台运行它,显然您可以将其作为守护程序运行,或运行特定版本(例如elasticsearch:1.7.2),并设置端口等。

5 个答案:

答案 0 :(得分:12)

向任何尝试我之前做过的人发出警告的话 - Gist中指定的URL是源版本,而不是编译版本,因此没有* .class文件。

您可以按原样使用Gist,但可以替换ElasticSearch网站上的最新下载网址,而不是目前在那里的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日的最新版本。要获得更新版本,请访问this页面,右键单击TAR链接(在“下载”部分下),复制链接并替换第一行中的wget参数。

答案 1 :(得分:8)

我以与您相同的方式安装了elasticsearch并遇到了同样的问题。最后,我通过安装编译版本而不是从github修复了问题。它涉及使用与gist相同的步骤,除了使用来自http://www.elasticsearch.org/download/2012/12/27/0.20.2.html而不是github的tar。我分叉并更新了https://gist.github.com/4512530提供的要点。希望这会有所帮助。

答案 2 :(得分:6)

按照此步骤轻松配置弹性搜索。

第1步 - 安装Java:

$ sudo apt-get update 

$ sudo apt-get install openjdk-7-jre 

$ java -version 

第2步 - 下载并安装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

第3步 - 配置弹性:

$ sudo nano /etc/elasticsearch/elasticsearch.yml

node.name:“我的第一个节点” cluster.name:mycluster1

$ sudo service elasticsearch start 

第4步 - 保护弹性:

$ sudo nano /etc/elasticsearch/elasticsearch.yml 

network.bind_host:localhost

script.disable_dynamic:true

第5步 - 测试:

$ curl -X GET 'http://localhost:9200' or run http://localhost:9200 in any browser. 

您应该看到以下回复:

{ 
"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 :(得分:3)

对elasticsearch网站上提供的deb文件进行解包,对我来说很好:

sudo dpkg -i elasticsearch-1.1.1.deb

答案 4 :(得分:0)