I use kubernetes to run es ,the container can not run ,and i get the error:bootstrap checks failed [1]: memory locking requested for elasticsearch process but memory is not locked

sh: error setting limit: Operation not permitted
[2017-06-26T19:47:56,556][WARN ][o.e.b.JNANatives ] Unable to lock JVM Memory: error=12, reason=Out of memory
[2017-06-26T19:47:56,561][WARN ][o.e.b.JNANatives ] This can result in part of the JVM being swapped out.
[2017-06-26T19:47:56,561][WARN ][o.e.b.JNANatives ] Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536
[2017-06-26T19:47:56,562][WARN ][o.e.b.JNANatives ] These can be adjusted by modifying /etc/security/limits.conf, for example:
# allow user 'elasticsearch' mlockall
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
[2017-06-26T19:47:56,562][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-06-26T19:47:56,849][INFO ][o.e.n.Node ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] initializing ...
[2017-06-26T19:47:57,038][INFO ][o.e.e.NodeEnvironment ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] using [1] data paths, mounts [[/data (/dev/mapper/centos-root)]], net usable_space [46.9gb], net total_space [49.9gb], spins? [possibly], types [xfs]
[2017-06-26T19:47:57,039][INFO ][o.e.e.NodeEnvironment ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-06-26T19:47:57,041][INFO ][o.e.n.Node ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] node name [3c1b1122-c60b-452b-b323-11a5e4957a3a], node ID [tQ-da20URuydKLGXfNFz4g]
[2017-06-26T19:47:57,042][INFO ][o.e.n.Node ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] version[5.4.2], pid[11], build[929b078/2017-06-15T02:29:28.122Z], OS[Linux/4.11.6-1.el7.elrepo.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_131/25.131-b11]
[2017-06-26T19:47:57,042][INFO ][o.e.n.Node ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Xms2g, -Xmx2g, -Des.path.home=/elasticsearch]
[2017-06-26T19:47:59,184][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] loaded module [aggs-matrix-stats]
[2017-06-26T19:47:59,184][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] loaded module [ingest-common]
[2017-06-26T19:47:59,184][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] loaded module [lang-expression]
[2017-06-26T19:47:59,184][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] loaded module [lang-groovy]
[2017-06-26T19:47:59,185][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] loaded module [lang-mustache]
[2017-06-26T19:47:59,185][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] loaded module [lang-painless]
[2017-06-26T19:47:59,185][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] loaded module [percolator]
[2017-06-26T19:47:59,185][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] loaded module [reindex]
[2017-06-26T19:47:59,185][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] loaded module [transport-netty3]
[2017-06-26T19:47:59,185][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] loaded module [transport-netty4]
[2017-06-26T19:47:59,186][INFO ][o.e.p.PluginsService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] no plugins loaded
[2017-06-26T19:48:01,828][INFO ][o.e.d.DiscoveryModule ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] using discovery type [zen]
[2017-06-26T19:48:03,043][INFO ][o.e.n.Node ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] initialized
[2017-06-26T19:48:03,044][INFO ][o.e.n.Node ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] starting ...
[2017-06-26T19:48:03,945][INFO ][o.e.t.TransportService ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] publish_address {172.17.17.2:9300}, bound_addresses {172.17.17.2:9300}
[2017-06-26T19:48:03,962][INFO ][o.e.b.BootstrapChecks ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: [1] bootstrap checks failed
[1]: memory locking requested for elasticsearch process but memory is not locked
[2017-06-26T19:48:03,979][INFO ][o.e.n.Node ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] stopping ...
[2017-06-26T19:48:04,143][INFO ][o.e.n.Node ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] stopped
[2017-06-26T19:48:04,144][INFO ][o.e.n.Node ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] closing ...
[2017-06-26T19:48:04,172][INFO ][o.e.n.Node ] [3c1b1122-c60b-452b-b323-11a5e4957a3a] closed

i use centos7 and use es 5.4.1,i set many parameters:
1)/etc/security/limits.conf:

  •    hard    nofile           65536
    
  •    soft    nofile           65536
    

elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
2)/etc/security/limits.d/90-nproc.conf

  • soft nproc 2048
    4)/etc/sysctl.conf :
    vm.max_map_count = 262144

when i set bootstrap.memory_lock:false the ES can run without problems.
what is wrong with it ?

I remember from another thread that your kubernetes service file needs to have IPC_LOCK capabilities configured in order to be able to lock memory.

i have it in the rc file :
capabilities:
add:
- IPC_LOCK

does the error “ setting limit: Operation not permitted ” cause ?

what else can cause the problem?

finally i solve it .it is the kubernetes make the problem .add
securityContext:
privileged: true
capabilities:
add:
- IPC_LOCK
to your rc file ,and you must make your api-server configfile the privileged=true too .
then you can run es successfully

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.