While deploying an Elasticsearch application on EAR (Elastic Application Runtime), the following error message might be observed.
[APP/REV/1/PROC/WEB/0] ERR bootstrap check failure [2] of [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Elasticsearch uses a mmapfs directory by default to store its indices. The Diego Cell OS limits on mmap counts is lower than the expected, which may result in out of memory exceptions.
The following steps can be followed to update the kernel parameters in EAR.
1. Upload the os-conf-release.
$ bosh upload-release https://bosh.io/d/github.com/cloudfoundry/os-conf-release2. Retrieve the bosh deployment GUID for EAR tile.
$ bosh ds --column=name | grep "cf-"
cf-<SOME-GUID>3. Create a file named diego-max-map-count.yml with following details.
---
releases:
- name: os-conf
version: 23.0.1 # Update the version accordingly
addons:
- name: diego-cell-max-map-count
jobs:
- name: sysctl
release: os-conf
properties:
sysctl:
- "vm.max_map_count=262144"
include:
deployments:
- cf-<SOME-GUID>
instance_groups:
- diego_cell
exclude:
deployments:
- <SOME-OTHER-GUID>4. Update the runtime config.
$ bosh update-runtime-config --name diego-max-map-count diego-max-map-count.yml5. Perform apply change against the EAR tile.
6. Once the apply change completes, run command similar to the following to validate the value of vm.max_map_count is now set to 262144.
$ bosh -d cf-<SOME-GUID> ssh diego_cell/0 -c 'sudo sysctl vm.max_map_count' | grep max_map_count
diego_cell/<SOME-GUID>: stdout | vm.max_map_count = 262144