boot2docker – Elasticsearch a max_map_count

Pokud používáte boot2docker, tak určitě narazíte při startu Elasticsearch služby na podobnou chybu:

Exception in thread "main" java.lang.RuntimeException: bootstrap checks failed
 initial heap size [268435456] not equal to maximum heap size [1073741824]; this can cause resize pauses and prevents mlockall from locking the entire heap
 max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
 at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:93)
 at org.elasticsearch.bootstrap.BootstrapCheck.check(BootstrapCheck.java:66)
 at org.elasticsearch.bootstrap.Bootstrap$5.validateNodeBeforeAcceptingRequests(Bootstrap.java:191)
 at org.elasticsearch.node.Node.start(Node.java:323)
 at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:206)
 at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:269)
 at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:111)
 at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:106)
 at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:91)
 at org.elasticsearch.cli.Command.main(Command.java:53)
 at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:74)
 at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:67)
 Refer to the log for complete error details.

Řešení:
Stačí upravit /var/lib/boot2docker/profile přídáním tohoto řádku na konec souboru a následně udělat reboot.

 # Update the vm.max_map_count setting
 sysctl -w vm.max_map_count=262144