Question: Java lang.RuntimeException: can not run elasticsearch as root
Solution:
Elaticsearch cannot be started by root by default, so it will report Java.Lang.runtimeException: can not run elasticsearch as root.
There are two types of solutions:
1. Modify the elaticsearch configuration to allow the root user to start (not recommended)
#Add the parameter -Des.insecure.allow.root=true when executing elasticSearch, the complete command is as follows
./elasticsearch -Des.insecure.allow.root=true
#Or open the elasticsearch executable file with vi, and add the following command before the variable ES_JAVA_OPTS is used
ES_JAVA_OPTS="-Des.insecure.allow.root=true"
2. Create users for elaticsearch and grant corresponding permissions
adduser es
passwd es
chown -R es:es elasticsearch-6.3.2/
chmod 770 elasticsearch-6.3.2/