1、can not run elasticsearch as root
switch to non-root user
Because of security issues, elasticsearch does not allow the root user to run directly, so create a new user
The first step: liunx creates a new user adduser XXX and then adds a password to the created user passwd XXX Enter the password twice.
Step 2: Switch to the user su XXX just created and then execute elasticsearch, it will display Permission denied and insufficient permissions.
Step 3: Give permission to the newly created XXX, chmod 777 * This will not work, because the user itself does not have permission, so he must not give himself permission. So use the root user to log in to pay permissions.
Step 4: Give root permission to XXX, chown -R XXX / your elasticsearch installation directory.
Then execute successfully.
2、main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")
Change elasticsearch folder owner to current user
sudo chown -R noroot:noroot elasticsearch
3、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
sudo vi /etc/sysctl.conf
Add the following configuration:
vm.max_map_count=655360
and execute the command:
sudo sysctl -p
4、max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
sudo vi /etc/security/limits.conf
Add the following:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
sudo vi /etc/pam.d/common-session
添加 session required pam_limits.so
sudo vi /etc/pam.d/common-session-noninteractive
Add session required pam_limits.so
If the service cannot be accessed by installing it into a virtual machine, you can modify the host address in elasticsearch.yml