Ubuntu16.04安装Supervisor

安装

sudo apt-get install supervisor 

启动,否则会报 unix:///tmp/supervisor.sock no such file

service supervisor start

或者

supervisord -c /etc/supervisor/supervisord.conf

 生成配置文件

echo_supervisord_conf > /etc/supervisor/supervisord.conf

注意里面的注释去掉

[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))

配置文件路径

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

查看状态

supervisorctl status #查看supervisorctl状态
supervisorctl start openfalcon #启动子进程
supervisorctl stop openfalcon  #关闭子进程
supervisorctl restart openfalcon #重启子进程

比如

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

配置文件在 /etc/supervisor 目录下

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

内容

[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

 

转载于:https://www.cnblogs.com/tonglin0325/p/11483918.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值