Docker 运行 Elasticsearch 报错 bootstrap checks failed 的解决方案
情形
| ERROR: [2] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-elasticsearch.log
|
原因及解决方案
设置的虚拟内存太低
- 在
/etc/security/limits.conf 中添加:
| * soft nofile 65536
* hard nofile 65536
|
- 在
/etc/sysctl.conf 中添加:
- 运行命令使其配置生效
- restart 容器
缺少默认配置
缺少默认配置,至少需要配置discovery.seed_hosts / discovery.seed_providers / cluster.initial_master_nodes中的一个参数.
discovery.seed_hosts: 集群主机列表
discovery.seed_providers: 基于配置文件配置集群主机列表
cluster.initial_master_nodes: 启动时初始化的参与选主的node,生产环境必填
解决方案
编辑配置文件,添加:
| discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["node-1"]
|
来源