1.ElasticSearch 对 jdk版本要求
ES JDK
0.90 1.6
----------------
1.3 1.7
... 1.7
2.4 1.7
----------------
5.0 1.8
... 1.8
6.X 1.8
... ...
? ?
2.jdk配置
请参考:centOS 7.4 安装配置jdk1.8
3.(1)ElasticSearch6.2.3 下载
也可在官网下载后上传
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.tar.gz
tar -zxvf elasticsearch-6.2.3.tar.gz
(3)创建用户
从5.0开始,ElasticSearch 安全级别提高了,不允许采用root帐号启动,所以我们要添加一个用户。
useradd www # 创建用户
passwd www # 设置该用户名密码
(4)修改目录权限
chmod 777 -R elasticsearch-6.2.3
(5)切换用户启动
su www
./elasticsearch-6.2.3/bin/elasticsearch
自动关闭,报错啦。。。
ERROR: [1] bootstrap checks failed
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
解决:切换到root用户,
(1)编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
添加如下内容:
* hard nofile 65536
* soft nofile 65536
* soft nproc 2048
* hard nproc 4096
# End of file
(2)修改/etc/sysctl.conf
添加如下内容
vm.max_map_count=262144
再次启动成功啦。。。
(6)停止
ctrl+c
^C[2018-03-24T23:17:30,185][INFO ][o.e.n.Node ] [VG9Zem6] stopping ...
[2018-03-24T23:17:30,205][INFO ][o.e.n.Node ] [VG9Zem6] stopped
[2018-03-24T23:17:30,205][INFO ][o.e.n.Node ] [VG9Zem6] closing ...
[2018-03-24T23:17:30,213][INFO ][o.e.n.Node ] [VG9Zem6] closed
(7)后台启动
./bin/elasticsearch -d
(8)查看进程
jps
1925 Jps
1882 Elasticsearch
或者:
ps -ef|grep elasticsearch
(8).验证
使用curl
curl http://localhost:9200
{
"name" : "VG9Zem6",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "9QO-zLXJRJyzbW9cJM2dLQ",
"version" : {
"number" : "6.2.3",
"build_hash" : "c59ff00",
"build_date" : "2018-03-13T10:06:29.741383Z",
"build_snapshot" : false,
"lucene_version" : "7.2.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}