elasticsearch安装教程

这两天安装ElasticSearch遇到了一点问题,hosts绑定127.0.0.1能正常启动,修改成192.168.1.11后,启动报了各种错误。
ES版本:5.4.1
环境:
虚拟机linux版本:centos6.9
本机:win10




网上找了一些解决方案,各种尝试之后终于能正常启动了,总结如下:
1)max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
原因:无法创建本地文件问题,用户最大可创建文件数太小
解决方案:切换到root用户,编辑limits.conf配置文件, 添加类似如下内容:
vi /etc/security/limits.conf
添加如下内容:
*  soft nofile 65536




* hard nofile 131072




* soft nproc 2048




* hard nproc 4096




备注:* 代表Linux所有用户名称(比如 hadoop)
需要保存、退出、重新登录才可生效。




2)max number of threads [1024] for user [es] likely too low, increase to at least [2048]
原因:无法创建本地线程问题,用户最大可创建线程数太小
解决方案:切换到root用户,进入limits.d目录下,修改90-nproc.conf 配置文件。
vi /etc/security/limits.d/90-nproc.conf
找到如下内容:
* soft nproc 1024




#修改为
* soft nproc 2048




3)max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
原因:最大虚拟内存太小
root用户执行命令:
[root@localhost ~]# sysctl -w vm.max_map_count=262144




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.4.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


以上问题解决后,es启动成功了,但又遇到了新的问题,本地机器无法访问虚拟机的服务,两个原因:
1)9200被限制为本机访问,需要在es的配置文件elasticsearch.yml中新增配置:
    network.bind_host:0.0.0.0
2)关闭虚拟机防火墙


解决了这个两个问题后,本地能够顺利访问虚拟机的ES服务了。

猜你喜欢

转载自blog.csdn.net/weixin_40400410/article/details/81565464