因为装的JDK 是1.7. elasticsearch 版本0.9,1.3-2.4 ,1.3支持JDK1.7,1.3以上的都支持1.8了。所以下载安装的是es 1.3版本;
下载 curl -L -O https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.3.9.tar.gz
解压 tar -xvf elasticsearch-1.3.9.tar.gz
启动 cd elasticsearch-1.3.9/bin ./elasticsearch
官网原话:
If everything goes well, you should see a bunch of messages that look like below:
./elasticsearch
[2014-03-13 13:42:17,218][INFO ][node ] [New Goblin] version[1.3.9], pid[2085], build[5c03844/2014-02-25T15:52:53Z]
[2014-03-13 13:42:17,219][INFO ][node ] [New Goblin] initializing ...
[2014-03-13 13:42:17,223][INFO ][plugins ] [New Goblin] loaded [], sites []
[2014-03-13 13:42:19,831][INFO ][node ] [New Goblin] initialized
[2014-03-13 13:42:19,832][INFO ][node ] [New Goblin] starting ...
[2014-03-13 13:42:19,958][INFO ][transport ] [New Goblin] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.8.112:9300]}
[2014-03-13 13:42:23,030][INFO ][cluster.service] [New Goblin] new_master [New Goblin][rWMtGj3dQouz2r6ZFL9v4g][mwubuntu1][inet[/192.168.8.112:9300]], reason: zen-disco-join (elected_as_master)
[2014-03-13 13:42:23,100][INFO ][discovery ] [New Goblin] elasticsearch/rWMtGj3dQouz2r6ZFL9v4g
[2014-03-13 13:42:23,125][INFO ][http ] [New Goblin] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.8.112:9200]}
[2014-03-13 13:42:23,629][INFO ][gateway ] [New Goblin] recovered [1] indices into cluster_state
[2014-03-13 13:42:23,630][INFO ][node ] [New Goblin] started启动的时候 如果 端口9200被占用,es会默认启用9201端口.这种方式启动es,退出只需要 ctrl+C 即可。现有插件:
1. elasticsearch 作为一个系统service应用 ,可以安装elasticsearch-servicewrapper插件。
在https://github.com/elasticsearch/elasticsearch-servicewrapper下载该插件后,解压缩。将service目录拷贝到elasticsearch目录的bin目录下。运行这个插件的好处是:elasticsearch需要的jvm参数和其它配置都已经配置好了,非常方便。
安装完启动 cd bin/service sh elasticsearch start 即可 属于 后台启动。 官网命令如下:
Parameter | Description |
---|---|
console | Run the elasticsearch in the foreground. |
start | Run elasticsearch in the background. |
stop | Stops elasticsearch if its running. |
install | Install elasticsearch to run on system startup (init.d / service). |
remove | Removes elasticsearch from system startup (init.d / service). |
2. 安装es-head插件
进入elasticsearch/bin目录,输入命令./plugin –install mobz/elasticsearch-head 安装head插件。 安装成功以后 在浏览器中输入http://localhost:9200,http://localhost:9200/_plugin/head/如下图所示则ES启动成功。