Ubuntu16.04安裝Supervisor

安裝linux

sudo apt-get install supervisor 

啓動,不然會報 unix:///tmp/supervisor.sock no such fileweb

service supervisor start

或者redis

supervisord -c /etc/supervisor/supervisord.conf

 生成配置文件apache

echo_supervisord_conf > /etc/supervisor/supervisord.conf

注意裏面的註釋去掉bash

[inet_http_server]         ; inet (TCP) server disabled by default
port=127.0.0.1:9001        ; (ip_address:port specifier, *:port for all iface)
username=user              ; (default is no username (open server))
password=123               ; (default is no password (open server))

配置文件路徑app

[include]
files = /etc/supervisor/conf.d/*.conf

查看狀態elasticsearch

supervisorctl status #查看supervisorctl狀態
supervisorctl start openfalcon #啓動子進程
supervisorctl stop openfalcon  #關閉子進程
supervisorctl restart openfalcon #重啓子進程

好比oop

lintong@master:~$ supervisorctl status
openfalcon                       RUNNING   pid 10759, uptime 0:18:46

配置文件在 /etc/supervisor 目錄下unix

lintong@master:/etc/supervisor$ ls
conf.d  start_openfalcon.conf  supervisord.conf

內容rest

[program:openfalcon]
command = cd ~/software/open-falcon-v0.2.1 & open-falcon start
user = lintong
autostart = true
autoresart = true
stderr_logfile = /var/log/supervisor/openfalcon.stderr.log
stdout_logfile = /var/log/supervisor/openfalcon.stdout.log

從新加載配置

supervisorctl reload

更新配置

supervisorctl update

web界面,帳號密碼參考 /etc/supervisord.conf

localhost:9001

下面是幾個例子

lintong@lintong-B250M-DS3H:/etc/supervisor/conf.d$ ls
es.conf  hadoop.conf  hive.conf  redis.conf

hadoop

[program:hadoop]
directory=/home/lintong/software/apache/hadoop-2.9.1
command = bash ./sbin/start-all.sh
user = lintong
autostart = true
autoresart = false
stderr_logfile = /var/log/supervisor/hadoop.stderr.log
stdout_logfile = /var/log/supervisor/hadoop.stdout.log

hive

[program:hive]
directory=/home/lintong/software/apache/apache-hive-2.3.3-bin
command = bash ./bin/hiveserver2 start
user = lintong
autostart = true
autoresart = true
stderr_logfile = /var/log/supervisor/hive.stderr.log
stdout_logfile = /var/log/supervisor/hive.stdout.log

es

[program:es]
directory=/home/lintong/software/apache/elasticsearch-6.2.4
command = bash ./bin/elasticsearch
user = lintong
autostart = true
autoresart = true
stderr_logfile = /var/log/supervisor/es.stderr.log
stdout_logfile = /var/log/supervisor/es.stdout.log

kafka_manager

其中的/bin/bash -c 'source "$0" && exec "$@"'是爲了解決cant find command問題

[program:kafka-manager]
directory=/home/lintong/software/apache/kafka-manager-1.3.3.17/bin
command = /bin/bash -c 'source "$0" && exec "$@"' kafka-manager -Dconfig.file=/home/lintong/software/apache/kafka-manager-1.3.3.17/conf/application.conf -Dhttp.port=7778
user = lintong
autostart = true
autoresart = false
stderr_logfile = /var/log/supervisor/kafka_manager.stderr.log
stdout_logfile = /var/log/supervisor/kafka_manager.stdout.log

kibana

[program:kibana]
directory=/home/lintong/software/apache/kibana-6.2.4-linux-x86_64
command = bash ./bin/kibana
user = lintong
autostart = false
autoresart = true
stderr_logfile = /var/log/supervisor/kibana.stderr.log
stdout_logfile = /var/log/supervisor/kibana.stdout.log
相關文章
相關標籤/搜索