bootstrap.memory_lock true导致Elasticsearch启动失败问题

elasticsearch官网建议生产环境需要设置bootstrap.memory_lock: true

重新启动elasticsearch,报错信息如下:

[[email protected] /home/baoshan/elk/elasticsearch-5.3.0]

$bin/elasticsearch

[2017-04-20T21:45:36,741][WARN ][o.e.b.JNANatives ] Unable to lock JVM Memory: error=12, reason=无法分配内存

[2017-04-20T21:45:36,746][WARN ][o.e.b.JNANatives ] This can result in part of the JVM being swapped out.

[2017-04-20T21:45:36,746][WARN ][o.e.b.JNANatives ] Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536

[2017-04-20T21:45:36,747][WARN ][o.e.b.JNANatives ] These can be adjusted by modifying /etc/security/limits.conf, for example: 

# allow user 'baoshan' mlockall

baoshan soft memlock unlimited

baoshan hard memlock unlimited

[2017-04-20T21:45:36,747][WARN ][o.e.b.JNANatives ] If you are logged in interactively, you will have to re-login for the new limits to take effect.

[2017-04-20T21:45:37,057][INFO ][o.e.n.Node ] [node-43] initializing ...

[2017-04-20T21:45:37,584][INFO ][o.e.e.NodeEnvironment ] [node-43] using [1] data paths, mounts [[/ (/dev/mapper/vg_root-lv_root)]], net usable_space [39.6gb], net total_space [44.7gb], spins? [possibly], types [ext4]

[2017-04-20T21:45:37,585][INFO ][o.e.e.NodeEnvironment ] [node-43] heap size [1.9gb], compressed ordinary object pointers [unknown]

[2017-04-20T21:45:37,587][INFO ][o.e.n.Node ] [node-43] node name [node-43], node ID [oUSfip81Sc-SGtZP9GCydg]

[2017-04-20T21:45:37,588][INFO ][o.e.n.Node ] [node-43] version[5.3.0], pid[5150], build[3adb13b/2017-03-23T03:31:50.652Z], OS[Linux/2.6.32-504.el6.x86_64/i386], JVM[Oracle Corporation/Java HotSpot(TM) Server VM/1.8.0_121/25.121-b13]

[2017-04-20T21:45:39,914][INFO ][o.e.p.PluginsService ] [node-43] loaded module [aggs-matrix-stats]

[2017-04-20T21:45:39,915][INFO ][o.e.p.PluginsService ] [node-43] loaded module [ingest-common]

[2017-04-20T21:45:39,916][INFO ][o.e.p.PluginsService ] [node-43] loaded module [lang-expression]

[2017-04-20T21:45:39,916][INFO ][o.e.p.PluginsService ] [node-43] loaded module [lang-groovy]

[2017-04-20T21:45:39,916][INFO ][o.e.p.PluginsService ] [node-43] loaded module [lang-mustache]

[2017-04-20T21:45:39,916][INFO ][o.e.p.PluginsService ] [node-43] loaded module [lang-painless]

[2017-04-20T21:45:39,917][INFO ][o.e.p.PluginsService ] [node-43] loaded module [percolator]

[2017-04-20T21:45:39,917][INFO ][o.e.p.PluginsService ] [node-43] loaded module [reindex]

[2017-04-20T21:45:39,917][INFO ][o.e.p.PluginsService ] [node-43] loaded module [transport-netty3]

[2017-04-20T21:45:39,917][INFO ][o.e.p.PluginsService ] [node-43] loaded module [transport-netty4]

[2017-04-20T21:45:39,919][INFO ][o.e.p.PluginsService ] [node-43] no plugins loaded

[2017-04-20T21:45:42,143][INFO ][o.e.n.Node ] [node-43] initialized

[2017-04-20T21:45:42,150][INFO ][o.e.n.Node ] [node-43] starting ...

[2017-04-20T21:45:42,282][WARN ][i.n.u.i.MacAddressUtil ] Failed to find a usable hardware address from the network interfaces; using random bytes: 5b:5f:0c:d6:78:e5:0b:ec

[2017-04-20T21:45:42,381][INFO ][o.e.t.TransportService ] [node-43] publish_address {10.88.128.88:9300}, bound_addresses {10.88.128.88:9300}

[2017-04-20T21:45:42,395][INFO ][o.e.b.BootstrapChecks ] [node-43] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks

ERROR: bootstrap checks failed

memory locking requested for elasticsearch process but memory is not locked

[2017-04-20T21:45:42,430][INFO ][o.e.n.Node ] [node-43] stopping ...

[2017-04-20T21:45:42,500][INFO ][o.e.n.Node ] [node-43] stopped

[2017-04-20T21:45:42,500][INFO ][o.e.n.Node ] [node-43] closing ...

[2017-04-20T21:45:42,525][INFO ][o.e.n.Node ] [node-43] closed


解决办法如下:

需要修改

/etc/security/limits.conf 

baoshan soft memlock unlimited

baoshan hard memlock unlimited

修改:

/etc/sysctl.conf 

vm.swappiness=0

之后重启机器


再次启动elasticsearch,成功,信息如下:

[[email protected] /home/baoshan/elk/elasticsearch-5.3.0]

$bin/elasticsearch

[2017-04-20T21:49:34,755][INFO ][o.e.n.Node ] [node-43] initializing ...

[2017-04-20T21:49:35,168][INFO ][o.e.e.NodeEnvironment ] [node-43] using [1] data paths, mounts [[/ (/dev/mapper/vg_root-lv_root)]], net usable_space [39.6gb], net total_space [44.7gb], spins? [possibly], types [ext4]

[2017-04-20T21:49:35,170][INFO ][o.e.e.NodeEnvironment ] [node-43] heap size [1.9gb], compressed ordinary object pointers [unknown]

[2017-04-20T21:49:35,176][INFO ][o.e.n.Node ] [node-43] node name [node-43], node ID [oUSfip81Sc-SGtZP9GCydg]

[2017-04-20T21:49:35,178][INFO ][o.e.n.Node ] [node-43] version[5.3.0], pid[1208], build[3adb13b/2017-03-23T03:31:50.652Z], OS[Linux/2.6.32-504.el6.x86_64/i386], JVM[Oracle Corporation/Java HotSpot(TM) Server VM/1.8.0_121/25.121-b13]

[2017-04-20T21:49:38,647][INFO ][o.e.p.PluginsService ] [node-43] loaded module [aggs-matrix-stats]

[2017-04-20T21:49:38,647][INFO ][o.e.p.PluginsService ] [node-43] loaded module [ingest-common]

[2017-04-20T21:49:38,647][INFO ][o.e.p.PluginsService ] [node-43] loaded module [lang-expression]

[2017-04-20T21:49:38,648][INFO ][o.e.p.PluginsService ] [node-43] loaded module [lang-groovy]

[2017-04-20T21:49:38,648][INFO ][o.e.p.PluginsService ] [node-43] loaded module [lang-mustache]

[2017-04-20T21:49:38,648][INFO ][o.e.p.PluginsService ] [node-43] loaded module [lang-painless]

[2017-04-20T21:49:38,649][INFO ][o.e.p.PluginsService ] [node-43] loaded module [percolator]

[2017-04-20T21:49:38,650][INFO ][o.e.p.PluginsService ] [node-43] loaded module [reindex]

[2017-04-20T21:49:38,650][INFO ][o.e.p.PluginsService ] [node-43] loaded module [transport-netty3]

[2017-04-20T21:49:38,650][INFO ][o.e.p.PluginsService ] [node-43] loaded module [transport-netty4]

[2017-04-20T21:49:38,652][INFO ][o.e.p.PluginsService ] [node-43] no plugins loaded

[2017-04-20T21:49:43,478][INFO ][o.e.n.Node ] [node-43] initialized

[2017-04-20T21:49:43,478][INFO ][o.e.n.Node ] [node-43] starting ...

[2017-04-20T21:49:43,650][WARN ][i.n.u.i.MacAddressUtil ] Failed to find a usable hardware address from the network interfaces; using random bytes: 5d:dc:90:e8:b1:e1:50:72

[2017-04-20T21:49:43,858][INFO ][o.e.t.TransportService ] [node-43] publish_address {10.88.128.88:9300}, bound_addresses {10.88.128.88:9300}

[2017-04-20T21:49:43,872][INFO ][o.e.b.BootstrapChecks ] [node-43] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks

[2017-04-20T21:50:13,896][WARN ][o.e.n.Node ] [node-43] timed out while waiting for initial discovery state - timeout: 30s

[2017-04-20T21:50:13,935][INFO ][o.e.h.n.Netty4HttpServerTransport] [node-43] publish_address {10.88.128.88:9200}, bound_addresses {10.88.128.88:9200}

[2017-04-20T21:50:13,950][INFO ][o.e.n.Node ] [node-43] started

OK,搞定!

你可能感兴趣的:(bootstrap.memory_lock true导致Elasticsearch启动失败问题)