Elasticsearch(003):es分布式集群搭建中可能出现的问题

一、root用户运行报错

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

解决方法:

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

# 执行即可
./elasticsearch -d

二、线程可操作的文件数错误

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

解决方法

切换到root用户,编辑limits.conf配置文件, 添加类似如下内容

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

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

三、最大虚拟内存错误

原因:最大虚拟内存太小

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

解决方法

切换到root用户下,修改配置文件sysctl.conf

vi /etc/sysctl.conf
#添加下面配置:
vm.max_map_count=655360
#并执行命令
sysctl -p
#然后重新启动elasticsearch,即可启动成功
发布了158 篇原创文章 · 获赞 147 · 访问量 27万+

猜你喜欢

转载自blog.csdn.net/weixin_39723544/article/details/103571480