报错信息
可以查看运行的日志看问题出在哪里
docker logs -f 容器ID
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-cluster.log
原因
官方的elasticsearch缺少配置,需要配置两处地方
解决办法
修改max_map_count大小
sysctl -w vm.max_map_count=262144
查看max_map_count,确保修改成功
sysctl -a|grep vm.max_map_count
跳转目录
cd /var/lib/docker/overlay2/
找到elasticsearch.yml配置文件
find . -name "elasticsearch.yml"
如果有多个容器会查到多个配置文件,每一个配置文件都添加一下配置信息
对配置文件进行编辑
在配置文件中增加两行配置
bootstrap.system_call_filter: false
cluster.initial_master_nodes: ["node-1"]
保存并退出
重新启动一下容器,这时候就可以在浏览器中使用配置的端口访问到信息啦
可以学习elasticsearch了/(ㄒoㄒ)/~~