Tag Archives: memory locking requested for elasticsearch process but memory is not locked

[Solved] Elasticsearch Startup Error: node validation exception

I played with the elasticsearch 5.3.0 binary environment today and found that it failed to start the es service, so I checked the logs in the logs/ directory of the deployment directory and found the following error:

#View the log, the log path is generally under the deployment directory logs/
cat . /logs/elasticsearch.log

#Error log
[ 2022-05-30T09 : 43 : 27,255 ] [ ERROR ][ oebBootstrap ][PBelckP] node validation exception
bootstrap checks failed
max file descriptors [ 65535 ] for elasticsearch process is too low, increase to at least [ 65536 ]
memory locking requested for elasticsearch process but memory is not locked
max virtual memory areas vm.max_map_count [ 65530 ] is too low, increase to at least [ 262144 ]
From the reported error, it is found that the node verification is abnormal, and the bootstrap check fails.

So I went to Google  and found that some kernel configuration parameters need to be adjusted. The following will explain the solutions one by one.

 

📌Question 1: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

💡Cause : The maximum file descriptor [65535] of the es process is too low.

📣Solution : Switch to the root user, edit the limits.conf file, and add the following: (soft nproc and hard nproc can also be set to 65536).

vim /etc/security/limits.conf

root soft nofile 65535 
root hard nofile 65535
# Add the following:
*soft nofile 65536 
*hard nofile 65536
Explanation of several key parameters:

* soft nofile 65536
* hard nofile 65536
* soft nproc 2048
* hard nproc 4096

① soft nproc: the maximum number of open file descriptors (soft limit)

② hard nproc: the maximum number of open file descriptors (hard limit)

③ soft nofile: the maximum number of processes available to a single user (soft limit)

④ hard nofile: the maximum number of processes available to a single user (hard limit)

Note : * represents all user names in Linux

Save, log out, and log in again to take effect

 

📌Question 2: memory locking requested for elasticsearch process but memory is not locked

💡Cause : The es process requested a memory lock, but failed to lock the memory.

📣Solution : Switch to the root user, edit the limits.conf configuration file, and add something like the following:

vim /etc/security/limits.conf

# Add the following:
* soft memlock unlimited
 * hard memlock unlimited

 

📌Question 3: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

💡Cause : es max virtual memory is too low.

📣Solution : Switch to the root user and modify the configuration file sysctl.conf.

vim /etc/sysctl.conf

# Add the following configuration:
vm.max_map_count = 655360

#Save and exit, and execute the command:
sysctl -p