Skip to main content

Configure virtual memory for Elasticsearch

By default, Elasticsearch uses mmapfs directory to store its indices. The limits on mmap is low on the default operating system. Therefore, before deploying Elasticsearch, you must configure its virtual memory by setting the vm.max_map_count limit to 262144 or higher on each Kubernetes node of the target cluster. Without this configuration, Elasticsearch pods will not be ready and the logs will contain the following error:

bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [XXX] is too low, increase to at least [262144] 

To set the vm.max_map_count limit on Linux:

  1. Get all names of the nodes running in the cluster:

    kubectl get nodes -o name
  2. Get ssh access in to each Kubernetes node:

    kubectl node-shell <node-name>
  3. Increase the limit as root:

    sysctl -w vm.max_map_count=262144

To set this limit permanently, run the following command:

grep -q vm.max_map_count /etc/sysctl.conf &&
sed -i 's/vm\.max_map_count=.*/vm\.max_map_count=262144/' /etc/sysctl.conf ||
echo "vm.max_map_count=262144" >> /etc/sysctl.conf
note

In EKS, the vm.max_map_count limit is set to 262144 by default. So, you need not perform this configuration in EKS. See Prerequisites for all the supported Kubernetes versions in PDS.

Was this page helpful?