Docker中的ElasticSearch会杀死容器



在最后一次git pull期间,我收到了一个修改过的docker-compose.yml文件。一位同事在docker compose中添加了elasticSerach

它对她有效,对我无效。我可以用docker-compose up启动容器并使其运行。但只要我想同步弹性搜索,容器就会自杀。然后我查看了容器日志,得到了几个错误消息。有人能帮我纠正这些错误吗?

也许是一个重要的提示。我的同事在Mac上工作,使用Docker Desktop,我在Linux系统上工作,只使用命令行。

{"log":"{"type": "server", "timestamp": "2022-01-27T08:31:28,148Z", "level": "INFO", "component": "o.e.x.s.c.f.PersistentCache", "cluster.name": "es-docker-cluster", "node.name": "es01", "message": "persistent cache index loaded" }n","stream":"stdout","time":"2022-01-27T08:31:28.148417236Z"}
{"log":"{"type": "server", "timestamp": "2022-01-27T08:31:28,148Z", "level": "INFO", "component": "o.e.x.d.l.DeprecationIndexingComponent", "cluster.name": "es-docker-cluster", "node.name": "es01", "message": "deprecation component started" }n","stream":"stdout","time":"2022-01-27T08:31:28.148994292Z"}
{"log":"{"type": "server", "timestamp": "2022-01-27T08:31:28,242Z", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "es-docker-cluster", "node.name": "es01", "message": "publish_address {17x.2x.x.x:9300}, bound_addresses {0.0.0.0:9300}" }n","stream":"stdout","time":"2022-01-27T08:31:28.242811316Z"}
{"log":"{"type": "server", "timestamp": "2022-01-27T08:31:28,355Z", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "es-docker-cluster", "node.name": "es01", "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks" }n","stream":"stdout","time":"2022-01-27T08:31:28.355514869Z"}
{"log":"n","stream":"stderr","time":"2022-01-27T08:31:28.363280214Z"}
{"log":"ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.n","stream":"stderr","time":"2022-01-27T08:31:28.363310562Z"}
{"log":"bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]n","stream":"stderr","time":"2022-01-27T08:31:28.363318535Z"}
{"log":"ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/es-docker-cluster.logn","stream":"stderr","time":"2022-01-27T08:31:28.363326669Z"}
{"log":"{"type": "server", "timestamp": "2022-01-27T08:31:28,364Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-docker-cluster", "node.name": "es01", "message": "stopping ..." }n","stream":"stdout","time":"2022-01-27T08:31:28.364606976Z"}
{"log":"{"type": "server", "timestamp": "2022-01-27T08:31:28,396Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-docker-cluster", "node.name": "es01", "message": "stopped" }n","stream":"stdout","time":"2022-01-27T08:31:28.3965249Z"}
{"log":"{"type": "server", "timestamp": "2022-01-27T08:31:28,396Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-docker-cluster", "node.name": "es01", "message": "closing ..." }n","stream":"stdout","time":"2022-01-27T08:31:28.396754682Z"}
{"log":"{"type": "server", "timestamp": "2022-01-27T08:31:28,407Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-docker-cluster", "node.name": "es01", "message": "closed" }n","stream":"stdout","time":"2022-01-27T08:31:28.407816795Z"}
{"log":"{"type": "server", "timestamp": "2022-01-27T08:31:28,409Z", "level": "INFO", "component": "o.e.x.m.p.NativeController", "cluster.name": "es-docker-cluster", "node.name": "es01", "message": "Native controller process has stopped - no new native processes can be started" }n","stream":"stdout","time":"2022-01-27T08:31:28.409846634Z"}

堆栈跟踪中已经提到了错误及其解决方案。

{"log":"bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]n","stream":"stderr","time":"2022-01-27T08:31:28.363318535Z"}

可用于docker进程的虚拟内存被设置为比弹性搜索所要求的内存更低的限制。所以你需要提高这个限制。具体来说,将vm.max_map_count的限制增加到262144(根据堆栈跟踪中的建议(

对于Mac-你可以在这里找到方法。

对于Linux-sysctl -w vm.max_map_count=262144

最新更新