linux 单机安装 Elasticsearch6.0.0 详细步骤以及问题解决方案
1.JDK版本必须1.8以上
安装jdk过程省略
2.下载 Elasticsearch6.0.0安装包
3.安装ES
3.1将下载好的tar包上传到服务器/opt目录下
3.2解压安装包
cd /opt
tar -zxvf elasticsearch-6.0.0.tar.gz
3.3创建ES用户和组(创建es用户组及es用户),因为不允许使用root用户执行;所以这里需要创建单独的用户去执行ES 文件;命令如下:
groupadd es
useradd es -g es
chown -R es:es elasticsearch-6.0.0
su - es
3.4 修改ES配置文件,使用cd命令进入到config 文件下,执行 vi elasticsearch.yml 命令,一定要拷贝文件中已经注释的例子,自己手写会报错的
,我这里只是修改IP
#network.host: 192.168.0.1
network.host: 192.168.2.71
3.5 执行ES文件,进入到bin 目录下执行 ./elasticsearch 命令就可以了,执行 ./elasticesrarch -d 是后台运行
启动日志在/opt/elasticsearch-6.0.0/logs这个目录下
查看日志报如下错误:
3.6 修改系统配置
3.6.1 max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] 意思是说你的进程不够用了
解决方案: 切到root 用户:进入到security目录下的limits.conf;执行命令 vim /etc/security/limits.conf 在文件的末尾添加下面的参数值:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
3.6.2 max number of threads [1024] for user [es] is too low, increase to at least [4096]
解决方案: 切到root 用户:执行命令 vi /etc/security/limits.d/90-nproc.conf 修改1024为4096:
* soft nproc 4096root soft nproc unlimited
3.6.3 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 需要修改系统变量的最大值了
解决方案:切换到root用户修改配置/etc/sysctl.conf 增加配置值: vm.max_map_count=655360
执行命令 sysctl -p 这样就可以了
[[email protected] ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
vm.max_map_count = 655360
3.6.4 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
3.7 再次登录服务器,保证修改后的配置生效,然后启动ES。
[[email protected] ~]$ curl -XGET 'http://192.168.2.71:9200'
{
"name" : "3ZMDmZI",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "QMkXf8sRQQOeF281C-8yvA",
"version" : {
"number" : "6.0.0",
"build_hash" : "8f0685b",
"build_date" : "2017-11-10T18:41:22.859Z",
"build_snapshot" : false,
"lucene_version" : "7.0.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
[[email protected] ~]$