Elasticsearch安装配置
1. 从Elastic官网下载最新版本的Elasticsearch,目前最新版本为V2.3.3。2. 解压
1
tar zxvf elasticsearch-2.3.2.tar.gz
3. 切换到Elasticsearch的bin目录下,启动服务。
1
2
./elasticsearch
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
启动时会发现Elasticsearch会报如下错误,因为Elasticsearch为安全起见不允许使用root账号启动服务。
4. 创建一个新账号
1
2
3
4
5
6
7
8
# useradd elasticsearchuser
# passwd elasticsearchuser
Changing password for user elasticsearchuser.
New password:
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
# usermod -g root elasticsearchuser
5. 重新启动服务。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ ./elasticsearch
unable to install syscall filter: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
version, pid, build
initializing ...
modules , plugins [], sites []
using data paths, mounts [[/ (/dev/sda2)]], net usable_space , net total_space , spins? , types
heap size , compressed ordinary object pointers
max file descriptors for elasticsearch process likely too low, consider increasing to at least
initialized
starting ...
publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
elasticsearch/kpitDjQNTwu8Q4D4pbWXnQ
new_master {Genis-Vell}{kpitDjQNTwu8Q4D4pbWXnQ}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, joins received)
publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
started
recovered indices into cluster_state
6. 服务也可以以守护进程方式运行
1
./elasticsearch -d
还可以在启动时同时指定pid
1
./elasticsearch -d -p pid
7. 在浏览器中访问一下,再次确认服务是完好的,但前提是修改/config/elasticsearch.yml,找到 network.host在下面添加一行,然后就可以在浏览器中访问http://10.0.0.5:9200/。
1
network.host : 10.0.0.5
浏览器显示内容如下:
{"name" : "Gargouille","cluster_name" : "elasticsearch","version" : { "number" : "2.3.2", "build_hash" : "b9e4a6acad4008027e4038f6abed7f7dba346f94", "build_timestamp" : "2016-04-21T16:03:47Z", "build_snapshot" : false, "lucene_version" : "5.5.0"},"tagline" : "You Know, for Search"}
至此,Elasticsearch安装启动完毕,更详细的操作还待后文。
页:
[1]