Docker安装ElasticSearch解决ERROR: bootstrap checks failed

@lianst  November 16, 2019

在使用docker(docker-compose)部署Elasticseatch的时候,总是启动之后容器就自己退出了,查看log发现报错信息:

[root@eip data]# docker-compose ps
 Name                Command                State            Ports         
---------------------------------------------------------------------------
cerebro   /opt/cerebro/bin/cerebro - ...   Up        0.0.0.0:9000->9000/tcp
es7_01    /usr/local/bin/docker-entr ...   Exit 78                         
es7_02    /usr/local/bin/docker-entr ...   Exit 78                         
kibana7   /usr/local/bin/dumb-init - ...   Up        0.0.0.0:5601->5601/tcp

[root@eip data]# docker-compose logs
...
es7_02            | ERROR: [1] bootstrap checks failed
# 设置的虚拟内存太低了,要求设置到262144.我们直接设置655360
es7_02            | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
...

解决方法

# 修改系统文件配合配置
[root@eip data]#  vim /etc/security/limits.conf 
....
* soft nofile 65536
* hard nofile 65536

[root@eip data]#  vim  /etc/sysctl.conf 
vm.max_map_count=655360

# 运行命令使其配置生效
[root@eip data]#  sysctl ‐p

# restart一下容器
[root@eip data]#  docker restart `docker ps -qa`

# 观察一下容器状态
    [root@eip data]# docker-compose ps
 Name                Command               State                Ports              
-----------------------------------------------------------------------------------
cerebro   /opt/cerebro/bin/cerebro - ...   Up      0.0.0.0:9000->9000/tcp          
es7_01    /usr/local/bin/docker-entr ...   Up      0.0.0.0:9200->9200/tcp, 9300/tcp
es7_02    /usr/local/bin/docker-entr ...   Up      9200/tcp, 9300/tcp              
kibana7   /usr/local/bin/dumb-init - ...   Up      0.0.0.0:5601->5601/tcp  


添加新评论