背景:

Elasticsearch启动报错:

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

 

解决方案:

一、临时修改:

vim /etc/profile

添加 ulimit -SHn 1048576

然后用普通用户执行 source /etc/profile

 

二、永久修改:

vim /etc/sysctl.conf

添加:fs.file-max = 1048576

执行 sysctl -p

 

vim /etc/security/limits.conf

添加:

* hard nofile 1048576
* soft nofile 1048576
root hard nofile 1048576
root soft nofile 1048576

再执行:
sed -i '/DefaultLimitNOFILE/c DefaultLimitNOFILE=1048576' /etc/systemd/*.conf
systemctl daemon-reexec

然后注销退出重新登录(注销如果不生效就重启一下)
验证:ulimit -Hn
posted on 2021-09-24 16:01  詹利弗  阅读(727)  评论(0编辑  收藏  举报