1. 安装
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.tar.gz
tar -xvzf elasticsearch-6.2.3.tar.gz
使用非root账号运行
adduser es
passwd es
然后输入密码
创建成功后
chown -R es:es elasticsearch-6.2.3
su es
2. 配置
cd elasticsearch-6.2.3/config
vim elasticsearch.yml
根据需要配置
network.host: 0.0.0.0 #允许任意ip访问
3. 运行
cd elasticsearch-6.2.3/bin
bin/elasticsearch
后台运行
nohup ./elasticsearch > elasticLog.log &
或
bin/elasticsearch -d
浏览器访问
ip地址:端口号 #端口号默认9200
返回一下内容表示启动成功
{
"name" : "nQjQYj2",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "h7oqDUO1Q8me_iSdN1ztag",
"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"
}
4. 可能出现的问题和解决方法
1. system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
问题原因:因为Centos6不支持SecComp,而ES5.2.1默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。详见:https://github.com/elastic/elasticsearch/issues/22899
解决方法:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
2. 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用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
添加如下内容:
soft nofile 65536
hard nofile 131072
soft nproc 2048
hard nproc 4096
3. max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
- 解决:切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
soft nproc 1024
修改为
soft nproc 2048
4. max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
- 解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p