我的要求
Example: Elastic
Install Supervisord on relevant Linux machine where elasticsearch is installed.
Create new supervisor conf file for elasticsearch
Configure command to run elasticsearch in the above conf.
Ensure that the command to be configured picks up all the configure files needed to run
elasticsearch
我已经安装了Supervisord,并创建了一个elasticsearch.conf文件。
[program:elasticsearch]
command=/usr/share/elasticsearch/bin
directory=/
autostart=true
autorestart=true
environment=SECRET_ID="secret_id",SECRET_KEY="secret_key"
startretries=3
stdout_logfile=/var/log/elasticsearch/elasticsearch.log
stderr_logfile=/var/log/elasticsearch/elasticsearch.log
获得错误。
ubuntu@abc:~$ sudo /etc/init.d/supervisor status
● supervisor.service - Supervisor process control system for UNIX
Loaded: loaded (/lib/systemd/system/supervisor.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-09-25 06:00:40 UTC; 2h 44min ago
Docs: http://supervisord.org
Main PID: 8746 (supervisord)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/supervisor.service
└─8746 /usr/bin/python /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
Sep 25 08:41:12 --- sudo[10529]: root : TTY=unknown ;
PWD=/usr/share/elasticsearch/bin ; USER=root ; COMMAND=/bin/syst…h.service
Sep 25 08:41:12 ip-*** sudo[10529]: pam_unix(sudo:session): session opened for user root by
(uid=0)
Sep 25 08:41:12 ip- sudo[10529]: pam_unix(sudo:session): session closed for user
root
Sep 25 08:41:12 ip-1 supervisord[8746]: 2019-09-25 08:41:12,384 INFO exited:
elasticsearch (exit status 0; not expected)
Sep 25 08:41:15 ip-1 supervisord[8746]: 2019-09-25 08:41:15,387 INFO spawned:
'elasticsearch' with pid 10656
Sep 25 08:41:15 ip-1 sudo[10656]: root : TTY=unknown ;
PWD=/usr/share/elasticsearch/bin ; USER=root ; COMMAND=/bin/syst…h.service
Sep 25 08:41:15 ip- sudo[10656]: pam_unix(sudo:session): session opened for user
root by (uid=0)
Sep 25 08:41:15 ip-1 sudo[10656]: pam_unix(sudo:session): session closed for user
root
Sep 25 08:41:15 ip- supervisord[8746]: 2019-09-25 08:41:15,780 INFO exited:
elasticsearch (exit status 0; not expected)
Sep 25 08:41:16 ip- supervisord[8746]: 2019-09-25 08:41:16,781 INFO gave up:
elasticsearch entered FATAL state, too many s…o quickly
Hint: Some lines were ellipsized, use -l to show in full.
我必须为主管配置Elasticsearch,请帮助我。
你需要像这样改变运行弹性二进制文件的用户。
[program:elasticsearch]
command=/usr/share/elasticsearch/bin
user=elasticsearch
directory=/
autostart=true
autorestart=true
environment=SECRET_ID="secret_id",SECRET_KEY="secret_key"
startretries=3
stdout_logfile=/var/log/elasticsearch/elasticsearch.log
stderr_logfile=/var/log/elasticsearch/elasticsearch.log
对我来说非常有效 :)