问题描述:
在搭建ES集群配置supervisor服务时,由于supervisor服务需要使用root用户启动,但ES服务却不能使用root用户启动,所以导致在用supervisor启动ES服务时,读取不到系统配置的文件句柄信息。启动时提示错误:(ES配置:bootstrap.memory_lock 已经设置为true)
[2020-09-18T16:15:00,193][ERROR][o.e.b.Bootstrap ] [node-2] node validation exception
[1] bootstrap checks failed
[1]: memory locking requested for elasticsearch process but memory is not locked
解决方案:
配置supervisor启动配置文件时,启动命令的时候指定ES的启动用户
[program:elasticsearch7]
command=su -c "/data1/opt/elasticsearch-7.6.2/bin/elasticsearch" admin
drectory=/data1/opt/elasticsearch-7.6.2/bin/
stdout_logfile=/var/local/supervisor/logs/es7.stdout
stderr_logfile=/var/local/supervisor/logs/es7.stderr
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=10
stderr_logfile_maxbytes=10MB
stderr_logfile_backups=10
autostart=true
priority=30
exitcodes=0,2
autorestart=unexpected
stopwaitsecs=60
killasgroup=true
stopasgroup=true