Briefly, this error occurs when Elasticsearch cannot parse the ‘vm.max_map_count’ kernel setting, which is crucial for Elasticsearch performance. This setting defines the maximum number of memory map areas a process may have. If it’s too low, Elasticsearch may fail. To resolve this issue, you can increase the ‘vm.max_map_count’ value. On Linux, use the command ‘sysctl -w vm.max_map_count=262144’. To make this change permanent, add ‘vm.max_map_count=262144’ to ‘/etc/sysctl.conf’. For Docker, use the command ‘docker-machine ssh’ to access the Docker machine and then apply the same commands.
We recommend you run Elasticsearch Error Check-Up which can resolve issues that cause many errors.
Advanced users might want to skip right to the common problems section in each concept or try running the Check-Up which analyses ES to pinpoint the cause of many errors and provides suitable actionable recommendations how to resolve them (free tool that requires no installation).
vm.max_map_count is defined as a Long data type in Elasticsearch.Â
This method in BootstrapChecks.java tries to convert it from String(Read in Sting) to the Long data type.
If you define a `vm.max_map_count` which can’t be converted to Long, then Elasticsearch throws NumberFormatException and logs below Error:
unable to parse vm.max_map_count
Overview
Elasticsearch has many settings that can cause significant performance problems if not set correctly. To prevent this happening, Elasticsearch carries out “bootstrap checks” to ensure that these important settings have been covered. If any of the checks fail, Elasticsearch will write an error to the logs and will not start. In this guide we cover common bootstrap checks you should know and how to configure your settings correctly to pass the checks successfully.
Bootstrap checks are carried out when the network.host setting in:
network.host: 0.0.0.0
If network host is not set and you use the default localhost, then Elasticsearch will consider the node to be in development mode, and bootstrap checks will not be enforced.
Common issues with bootstrap checks
If you install elasticsearch using RPM or Debian packages (strongly recommended) then most of the important configuration is already done for you, and the only bootstrap checks you are likely to run up against are the following.
Heap size check
The minimum and maximum heap sizes specified in jvm.options (or via environment variables) must be equal to one another.
File descriptors check
Minimum file descriptors must have been set to at least 65535
Memory lock check
There are various methods used to prevent memory swapping, and you must use one of them. The most common is to set in elasticsearch.yml
bootstrap.memory_lock: true
For this to be effective you must give permission to elasticsearch to enable this. There are various ways to do so, depending upon your operating system.
Discovery configuration checks
At least one of the following properties must be configured in elasticsearch.yml to ensure that your node can form a cluster properly:
- discovery.seed_hosts
- discovery.seed_providers
- cluster.initial_master_nodes
Less common bootstrap check issues
If you are not using RPM or debian packages, you may come across the following issues:
Max number of threads check
You must allow your system to create at least 4096 threads. In linux this is done by editing /etc/security/limits.conf and adjusting the nproc setting.
Max file size check
Your system should be able to create unlimited file sizes. In linux this is done by editing /etc/security/limits.conf and adjusting the fsize setting
Max virtual memory check
The system should be able to create unlimited virtual memory for the elasticsearch user.
This is done by editing /etc/security/limits.conf
<user> - as unlimited
Max map count check
The system must be able to use mmap effectively. This is done by running the command
sysctl vm.max_map_count 262144
Other checks
The following checks are also carried out, but are rarely found:
OsX File Descriptor Check Client Jvm Check UseS erial GC Check System Call Filter Check Might Fork Check On Error Check On Out Of Memory Error Check Early Access Check G1GC Check All Permission Check
Log Context
Log “Unable to parse vm.max_map_count [{}]” classname is BootstrapChecks.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
final String rawProcSysVmMaxMapCount = readProcSysVmMaxMapCount(bufferedReader); if (rawProcSysVmMaxMapCount != null) { try { return parseProcSysVmMaxMapCount(rawProcSysVmMaxMapCount); } catch (final NumberFormatException e) { logger.warn(() -> new ParameterizedMessage("unable to parse vm.max_map_count [{}]"; rawProcSysVmMaxMapCount); e); } } } catch (final IOException e) { logger.warn(() -> new ParameterizedMessage("I/O exception while trying to read [{}]"; path); e); }
[ratemypost]