elasticsearch踩过的坑解决办法
1、Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error=’Cannot allocate memory’ (errno=12)
由于elasticsearch5.0默认分配jvm空间大小为2g,修改jvm空间分配
1 | vim config/jvm.options |
2、max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048] 修改 /etc/security/limits.d/90-nproc.conf
1 | soft nproc 1024 |
3、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf配置文件,
1 | cat /etc/sysctl.conf | grep vm.max_map_count |
如果不存在则添加
1 | echo "vm.max_map_count=262144" >>/etc/sysctl.conf |
4、max file descriptors [65535] for elasticsearch process likely too low, increase to at least [65536]
1 | ulimit -n 65536 |
5.外网访问
1 | vi conf/elasticsearch.yml |
修改network.host: 0.0.0.0
再次启动linux可能出现如下类似错误
1 | bootstrap checks failed |
解决方案
1、vi /etc/sysctl.conf
设置fs.file-max=655350
保存之后sysctl -p使设置生效
2、vi /etc/security/limits.conf 新增
1 | soft nofile 655350 |
3、重新使用SSH登录,再次启动elasticsearch即可。
外网访问:serverip:9200/