Elasticsearch (003): es to build a distributed cluster problems that may arise

A, root users to run error

Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.

Solution:

#添加es用户
useradd es
#给es用户授权目录权限
chown es:es -R /usr/es/
# 切换到es用户运行接口
su es

# 执行即可
./elasticsearch -d

Second, the file number of threads operational error

ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

Solution

Switch to root, edit limits.conf configuration file and add the following similar

# 切换到root用户
su root
vi /etc/security/limits.conf

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
#备注:* 代表Linux所有用户名称(比如 hadoop)
#保存、退出、重新登录才可生效

Third, the maximum virtual memory error

The reason: the maximum virtual memory is too small

ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Solution

The switch to root, modify the configuration file sysctl.conf

vi /etc/sysctl.conf
#添加下面配置:
vm.max_map_count=655360
#并执行命令
sysctl -p
#然后重新启动elasticsearch,即可启动成功
Published 158 original articles · won praise 147 · views 270 000 +

Guess you like

Origin blog.csdn.net/weixin_39723544/article/details/103571480