Unable to lock JVM memory (ENOMEM)

I have recently started using elasticsearch. We(my company) use elasticsearch on postgres and its python client. I have installed marvel plugin and tried using it for a day. I suspended my laptop and next day I opened my laptop and reran elasticsearch. I am getting this error while starting the elasticsearch!

Unable to lock JVM memory (ENOMEM). This can result in part of the JVM being swapped out. Increase RLIMIT_MEMLOCK (ulimit).

Below is the complete stacktrace.

[2015-11-27 13:22:47,567][WARN ][bootstrap ] Unable to lock JVM memory (ENOMEM). This can result in part of the JVM being swapped out. Increase RLIMIT_MEMLOCK (ulimit).
[2015-11-27 13:22:47,688][INFO ][node ] [Jonathan "John" Garrett] version[1.6.0], pid[5035], build[cdd3ac4/2015-06-09T13:36:34Z]
[2015-11-27 13:22:47,688][INFO ][node ] [Jonathan "John" Garrett] initializing ...
[2015-11-27 13:22:47,699][INFO ][plugins ] [Jonathan "John" Garrett] loaded [marvel], sites [marvel]
[2015-11-27 13:22:47,756][INFO ][env ] [Jonathan "John" Garrett] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [77.4gb], net total_space [454.4gb], types [ext4]
[2015-11-27 13:22:51,029][INFO ][node ] [Jonathan "John" Garrett] initialized
[2015-11-27 13:22:51,029][INFO ][node ] [Jonathan "John" Garrett] starting ...
{1.6.0}: Startup Failed ...

  • BindTransportException[Failed to bind to [9300-9400]]
    ChannelException[Failed to bind to: /121.0.0.1:9400]
    BindException[Cannot assign requested address]

Its not an error, its just a warning.

You asked to mlockall() the heap by configuring bootstrap.mlockall, but the call failed so it was not actually able to do that.

If you want to fix it, then you have to fix your system limits so that it is possible:

The mlockall() function may fail if:

[ENOMEM] Locking all of the pages currently mapped into the address space of the process would exceed an implementation-defined limit on the amount of memory that the process may lock.

http://pubs.opengroup.org/onlinepubs/009695399/functions/mlockall.html