我正在尝试在Amazon Linux AMI(标准版)上运行新的Elasticsearch 6.0 docker容器。我以前在不同的实例上运行5.6并没有问题,但是当我启动它时,我的容器会立即崩溃。
这是我使用的命令:docker run -it -p 9200:9200 -p 9300:9300 -d docker.elastic.co/elasticsearch/elasticsearch:6.0.0
我在Docker崩溃时引用了这篇文章,但似乎仍然遇到了同样的问题:Why docker container exits immediately
我运行了docker日志并获得以下响应:
[2017-11-28T19:00:30,946][INFO ][o.e.n.Node ] [] initializing ...
[2017-11-28T19:00:31,013][INFO ][o.e.e.NodeEnvironment ] [eEXrI6m] using [1] data paths, mounts [[/ (overlay)]], net usable_space [4.5gb], net total_space [7.7gb], types [overlay]
[2017-11-28T19:00:31,014][INFO ][o.e.e.NodeEnvironment ] [eEXrI6m] heap size [989.8mb], compressed ordinary object pointers [true]
[2017-11-28T19:00:31,015][INFO ][o.e.n.Node ] node name [eEXrI6m] derived from node ID [eEXrI6mGTci22tpTNMMh8w]; set [node.name] to override
[2017-11-28T19:00:31,015][INFO ][o.e.n.Node ] version[6.0.0], pid[1], build[8f0685b/2017-11-10T18:41:22.859Z], OS[Linux/4.9.62-21.56.amzn1.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_151/25.151-b12]
[2017-11-28T19:00:31,015][INFO ][o.e.n.Node ] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.cgroups.hierarchy.override=/, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [aggs-matrix-stats]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [analysis-common]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [ingest-common]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [lang-expression]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [lang-mustache]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [lang-painless]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [parent-join]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [percolator]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [reindex]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [repository-url]
[2017-11-28T19:00:32,283][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [transport-netty4]
[2017-11-28T19:00:32,284][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded module [tribe]
[2017-11-28T19:00:32,284][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded plugin [ingest-geoip]
[2017-11-28T19:00:32,284][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded plugin [ingest-user-agent]
[2017-11-28T19:00:32,284][INFO ][o.e.p.PluginsService ] [eEXrI6m] loaded plugin [x-pack]
[2017-11-28T19:00:34,795][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/120] [Main.cc@128] controller (64 bit): Version 6.0.0 (Build 8e6ab35cf803a2) Copyright (c) 2017 Elasticsearch BV
[2017-11-28T19:00:34,834][INFO ][o.e.d.DiscoveryModule ] [eEXrI6m] using discovery type [zen]
[2017-11-28T19:00:35,513][INFO ][o.e.n.Node ] initialized
[2017-11-28T19:00:35,513][INFO ][o.e.n.Node ] [eEXrI6m] starting ...
[2017-11-28T19:00:35,648][INFO ][o.e.t.TransportService ] [eEXrI6m] publish_address {xxx.xx.x.x:9300}, bound_addresses {0.0.0.0:9300}
[2017-11-28T19:00:35,664][INFO ][o.e.b.BootstrapChecks ] [eEXrI6m] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2017-11-28T19:00:35,675][INFO ][o.e.n.Node ] [eEXrI6m] stopping ...
[2017-11-28T19:00:35,734][INFO ][o.e.n.Node ] [eEXrI6m] stopped
[2017-11-28T19:00:35,734][INFO ][o.e.n.Node ] [eEXrI6m] closing ...
[2017-11-28T19:00:35,745][INFO ][o.e.n.Node ] [eEXrI6m] closed
答案 0 :(得分:2)
看起来你的错误就在这里:
错误:[2]引导程序检查失败 1:弹性搜索过程的最大文件描述符[4096]太低,增加到至少[65536] [2]:最大虚拟内存区域vm.max_map_count [65530]太低,至少增加[262144]
ElasticSearch挑剔需要足够的文件描述符和来自它主机的内存;他们页面上的文档有一些关于如何设置它的信息 - 取决于你的主机是什么:
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
在按上方调整主机后,其页面会讨论docker-compose
的设置,但是如果您仍想使用docker run
,则可以找到等效的命令here。
答案 1 :(得分:0)
您可以尝试添加ulimit部分:
services:
elastic:
image: elasticsearch
ulimits:
nofile:
soft: 65536
hard: 65536
或在
中更改限制/etc/security/limits.conf
您可以使用来查看实际限制
cat /proc/<pid>/limits
进程运行时。