Troubleshooting of errors in installing elasticsearch

When elasticsearch is installed, various errors are reported during startup. The summary is as follows:

Error 1

Java.lang.runtimeexception: can not run elasticsearch as root
solution: use a non root user to start es
 

Error report 2

max virtual memory areas vm.max_ map_ count [65530] is too low, increase to at least [262144]

Solution:
switch root user
VI  / Etc/sysctl. Conf
add the last line
vm.max_ map_ Count = 655360
execute the command: sysctl – P
 

Error reporting 3

the default discovery settings are unsuitable for production use; at least one of [discovery.seed_ hosts, discovery.seed_ providers, cluster.initial_ master_ nodes] must be configured

Solution:
in the config directory of elasticsearch, modify the elasticsearch.yml configuration file and add the following configuration to the configuration file:
cluster.initial_ master_ nodes: [“node-1”]

Error reporting 4

Max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
the maximum number of files opened simultaneously in each process is too small. You can view the current number through the following two commands

ulimit -Hn
ulimit -Sn

Switch the root user, modify the/etc/security/limits.conf file, add the configuration, and log in again after the user exits

*               soft    nofile          65536
*               hard    nofile          65536

Error reporting 5

max number of threads [3818] for user [es] is too low, increase to at least [4096]

The problem is the same as above. The maximum number of threads is too low. Modify the configuration file/etc/security/limits.conf (and question 4 is a file) and add the configuration

*               soft    nproc           4096
*               hard    nproc           4096

It can be viewed through the command

ulimit -Hu
ulimit -Su

 

Modified file:

 

 

 

Read More: