Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES 2.0.0: Cannot mlockall even when privileged or with --cap-add=IPC_LOCK #70

Closed
jimmidyson opened this issue Nov 20, 2015 · 4 comments
Closed

Comments

@jimmidyson
Copy link

With Docker 1.9.0 & elasticsearch:2.0.0:

$ docker run --rm --privileged elasticsearch:2.0.0 -Des.bootstrap.mlockall=true
[2015-11-20 09:06:08,908][WARN ][bootstrap                ] Unable to lock JVM Memory: error=12,reason=Cannot allocate memory
[2015-11-20 09:06:08,908][WARN ][bootstrap                ] This can result in part of the JVM being swapped out.
[2015-11-20 09:06:08,908][WARN ][bootstrap                ] Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536
[2015-11-20 09:06:08,908][WARN ][bootstrap                ] These can be adjusted by modifying /etc/security/limits.conf, for example: 
        # allow user 'elasticsearch' mlockall
        elasticsearch soft memlock unlimited
        elasticsearch hard memlock unlimited

I assume this is still recommended & supposed to work?

@jimmidyson
Copy link
Author

Closing - for anyone else that comes across this the following works (& doesn't require privileged either):

docker run --rm --cap-add=IPC_LOCK --ulimit memlock=-1:-1 elasticsearch:2.0.0 -Des.bootstrap.mlockall=true

@nikolai-derzhak-distillery

@jimmidyson Thanks man !

@orweinberger
Copy link

@jimmidyson Been looking for this, thank you.

@aalexgabi
Copy link

aalexgabi commented Jul 13, 2016

Edit: It seems that Elasticsearch configuration must be mounted in /usr/share/elasticsearch/config and not /etc/elasticsearch. The presence of /etc/elasticsearch is confusing. Why the Docker image doesn't use the standard /etc/elasticsearch path?

Original post:

After at least 6 hours of struggling to get it working this helped me solve it. 
`bootstrap.mlockall: true` option was present in my configuration but it seems it's not enough. Once I added `-Des.bootstrap.mlockall=true` to the run command it worked (i already had `--cap-add=IPC_LOCK --ulimit memlock=-1:-1`).

This should be documented somewhere. Maybe even https://www.elastic.co/guide/en/elasticsearch/reference/1.7/setup-configuration.html should mention it.

@jimmidyson Why setting `bootstrap.mlockall=true` in the configuration is not enough?

Using [email protected]

1gtm pushed a commit to appscode-images/elasticsearch that referenced this issue Feb 14, 2024
This commit was created by the elastic-dockerfiles-publisher.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants