Docker安装ElasticSearch解决ERROR: bootstrap checks failed : max virtual memory…default discovery setting

上段时间在部署ElasticSearch时,遇到一些小问题

下载ElasticSearch镜像
docker pull elasticsearch:7.0.0

创建容器实例并启动


docker run -d -e ES_JAVA_POTS="-Xms256m -Xmx256m"  -e "discovery.type=single-node" -p 9200:9200 -p 
9300:9300 --name ES01 elasticsearch:7.0.0

报错:
ERROR: [2] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 
[2][2]: the default discovery settings are unsuitable for production use; at least one of [discovery.see

日志中显示的错误
ERROR: [1] bootstrap checks failed
[1] the default discovery settin:gs are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

报错原因


解决方案:
修改镜像配置
 

 找到jvm.options文件
 修改JVM空间分配
-Xms2g  
-Xmx2g
比如修改为

-Xms512m  
-Xmx512m    

改:/etc/security/limits.conf  在文档尾追加
* soft nofile 65536
* hard nofile 65536

修改: /etc/sysctl.conf 在文档尾追加
vm.max_map_count=655360

执行命令:
sysctl ‐p
 

你可能感兴趣的:(项目运营和部署,分布式微服务)