elasticsearch 启动失败 vm.max_map_count 太小问题

[2017-11-24T11:34:55,546][INFO ][o.e.n.Node               ] [] initializing …

[2017-11-24T11:34:55,623][INFO ][o.e.e.NodeEnvironment    ] [s_mMdLS] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [184.4gb], net total_space [196.7gb], types [rootfs]

[2017-11-24T11:34:55,623][INFO ][o.e.e.NodeEnvironment    ] [s_mMdLS] heap size [1007.3mb], compressed ordinary object pointers [true]

[2017-11-24T11:34:55,624][INFO ][o.e.n.Node               ] node name [s_mMdLS] derived from node ID [s_mMdLSxSC6ChpRx5E8DxQ]; set [node.name] to override

[2017-11-24T11:34:55,624][INFO ][o.e.n.Node               ] version[6.0.0], pid[31030], build[8f0685b/2017-11-10T18:41:22.859Z], OS[Linux/3.10.0-693.5.2.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_151/25.151-b12]

[2017-11-24T11:34:55,624][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.path.home=/home/lcsuper/opt/elasticsearch-6.0.0, -Des.path.conf=/home/lcsuper/opt/elasticsearch-6.0.0/config]

[2017-11-24T11:34:56,404][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [aggs-matrix-stats]

[2017-11-24T11:34:56,404][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [analysis-common]

[2017-11-24T11:34:56,404][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [ingest-common]

[2017-11-24T11:34:56,404][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [lang-expression]

[2017-11-24T11:34:56,404][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [lang-mustache]

[2017-11-24T11:34:56,404][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [lang-painless]

[2017-11-24T11:34:56,405][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [parent-join]

[2017-11-24T11:34:56,405][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [percolator]

[2017-11-24T11:34:56,405][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [reindex]

[2017-11-24T11:34:56,405][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [repository-url]

[2017-11-24T11:34:56,405][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [transport-netty4]

[2017-11-24T11:34:56,405][INFO ][o.e.p.PluginsService     ] [s_mMdLS] loaded module [tribe]

[2017-11-24T11:34:56,405][INFO ][o.e.p.PluginsService     ] [s_mMdLS] no plugins loaded

[2017-11-24T11:34:58,037][INFO ][o.e.d.DiscoveryModule    ] [s_mMdLS] using discovery type [zen]

[2017-11-24T11:34:58,536][INFO ][o.e.n.Node               ] initialized

[2017-11-24T11:34:58,536][INFO ][o.e.n.Node               ] [s_mMdLS] starting …

[2017-11-24T11:34:58,660][INFO ][o.e.t.TransportService   ] [s_mMdLS] publish_address {47.104.57.186:9300}, bound_addresses {0.0.0.0:9300}

[2017-11-24T11:34:58,670][INFO ][o.e.b.BootstrapChecks    ] [s_mMdLS] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks

ERROR: [1] bootstrap checks failed

[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

[2017-11-24T11:34:58,677][INFO ][o.e.n.Node               ] [s_mMdLS] stopping …

[2017-11-24T11:34:58,692][INFO ][o.e.n.Node               ] [s_mMdLS] stopped

[2017-11-24T11:34:58,692][INFO ][o.e.n.Node               ] [s_mMdLS] closing …

[2017-11-24T11:34:58,702][INFO ][o.e.n.Node               ] [s_mMdLS] closed

解决办法:
1、切换到root用户修改配置sysctl.conf

vi /etc/sysctl.conf 

添加下面配置:

vm.max_map_count=655360

并执行命令:

sysctl -p

然后,重新启动elasticsearch,即可启动成功

加入讨论