使用supervisor管理elk进程
1.安装supervisor:pip install supervisor 【有可能会安装不成功,请查找其他方法安装】
2.修改管理elk进程的配置文件:vim /etc/supervisord.conf
[unix_http_server] file=/tmp/supervisor.sock ; the path to the socket file [supervisord] logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB logfile_backups=10 ; # of main logfile backups; 0 means none, default 10 loglevel=info ; log level; default info; others: debug,warn,trace pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid nodaemon=false ; start in foreground if true; default false minfds=1024 ; min. avail startup file descriptors; default 1024 minprocs=200 ; min. avail process descriptors;default 200
[inet_http_server] #启用页面管理:http://xxxxxxx:9001
port=0.0.0.0:9001
username=admin
password=123456
[rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [supervisorctl] serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:zookeeper]
command=/data/elk/kafka/bin/zookeeper-server-start.sh /data/elk/kafka/config/zookeeper.properties
directory=/data/elk/kafka/
autostart=true
autorestart=true
startsecs=1
redirect_stderr=true
stdout_logfile=/tmp/zookeeper.log
user=root
stopsignal=QUIT
[program:kafka] command=/data/kafka/bin/kafka-server-start.sh /data/kafka/config/server.properties directory=/data/kafka/ autostart=true autorestart=true startsecs=20 redirect_stderr=true stdout_logfile=/tmp/kafka.log user=root stopsignal=QUIT [program:logstash] command=/data/logstash/bin/logstash -f /data/logstash/config/logstash.conf directory=/data/logstash/ autostart=true autorestart=true redirect_stderr=true stdout_logfile=/tmp/logstash.log user=root stopsignal=QUIT [program:elasticsearch] command=/data/elasticsearch/bin/elasticsearch directory=/data/elasticsearch/ autostart=true autorestart=true redirect_stderr=true stdout_logfile=/tmp/elasticsearch.log user=elastic stopsignal=QUIT [program:kibana] command=/data/kibana/bin/kibana directory=/data/kibana/ autostart=true autorestart=true redirect_stderr=true stdout_logfile=/tmp/kibana.log user=root stopsignal=QUIT
3.启动supervisor:supervisord -c /etc/supervisord.conf
4.使用supervisorctl:supervisorctl status Usage: /usr/bin/supervisorctl [options] [action [arguments]]
supervisorctl restart/start/stop elasticsearch
一些事情一直在干,说不定以后就结果了呢
本文来自博客园,作者:chenjianwen,转载请注明原文链接:https://www.cnblogs.com/chenjw-note/articles/10910988.html