Supervisor 进程管理Redis,zookeeper,kafka,cerebro,elasticsearch 以及相应ini配置

在这里插入图片描述

1.使用yum命令安装supervisor
yum install -y epel-release
yum install -y supervisor

2.修改supervisor配置
cd /etc
vim supervisord.conf

# web登录界面
[inet_http_server]         ; inet (TCP) server disabled by default
port=0.0.0.0:9001        ; (ip_address:port specifier, *:port for all iface)
username=admin              ; (default is no username (open server))
password=Cocktail_py_123               ; (default is no password (open server))

# 命令行
[supervisorctl]
serverurl=unix:///var/run/supervisor/supervisor.sock ; use a unix:// URL  for a unix socket
serverurl=http://0.0.0.0:9001 ; use an http:// url to specify an inet socket
;username=chris              ; should be same as http_username if set
;password=123                ; should be same as http_password if set
;prompt=mysupervisor         ; cmd line prompt (default "supervisor")
;history_file=~/.sc_history  ; use readline history if available

# 相应配置文件,这里需要绝对路径
[include]
files = /etc/supervisord.d/*.ini
3. .ini配置文件文件
cd /etc/supervisord.d/
vim redis.ini
# redis配置文件
[program:redis]
command=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
autostart=true
autorestart=true
startsecs=3

# 注意 redis.conf文件需要修改
# daemonize no

vim zookeeper.ini
# zookeeper配置文件
[program:zookeeper]
command=/usr/local/zookeeper/bin/zkServer.sh start-foreground
user=root
autostart=true
autorestart=true
startsecs=3

vim kafka.ini
# kafka配置文件
[program:kafka]
command=/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties
user=root
autostart=true
autorestart=true
startsecs=3

vim es.ini
# elasticsearch配置文件
[supervisord]
minfds=65536
minprocs=32768

[program:es-node]
command     = /data/elasticsearch-6.0.0/bin/elasticsearch
directory   = /data/elasticsearch-6.0.0
user        = elk
startsecs   = 3
redirect_stderr         = true
stdout_logfile_maxbytes = 50MB
stdout_logfile_backups  = 10
stdout_logfile          = /data/elasticsearch-6.0.0/logs/supervisor.log

vim cerebro.ini
# cerebro配置文件
[program:cerebro-node]
command     = /opt/cerebro-0.8.1/bin/cerebro -Dhttp.port=12345 -Dhttp.address=0.0.0.0
directory   = /opt/cerebro-0.8.1/
user        = elk
startsecs   = 3

redirect_stderr         = true
stdout_logfile_maxbytes = 100MB
stdout_logfile_backups  = 10
stdout_logfile          = /opt/cerebro-0.8.1/logs/supervisor.log
4.以配置文件的方式启动supervisor
supervisord -c /etc/supervisord.conf
5.supervisor相关命令
systemctl enable supervisord # 开机自启动
systemctl status supervisord # 查看supervisord服务状态
# ps -ef|grep supervisord # 查看是否存在supervisord进程
# systemctl reload supervisord # 重新加载
# systemctl restart supervisord
# systemctl start supervisord # 启动supervisord服务


1、使用如下命令更新Supervisor的配置。

supervisorctl update
如果设置了账号密码就需要
supervisorctl -uxxxxx -pxxxx update

2、重启所需的服务

supervisorctl restart program_name

[program:rabbitmq_worker]
command=php /home/wwwroot/rabbitmq/worker/receive.php
process_name=%(program_name)s_%(process_num)02d              ;多进程名称肯定不同,匹配多个
numprocs=4                                                   ;启动多个进程
autostart=true                           ;是否随supervisor启动
autorestart=true                         ;是否在挂了之后重启,意外关闭后会重启,比如kill掉!
startsecs=5
startretries=3                           ;启动尝试次数
stderr_logfile=/tmp/rabbitmq_worker_err.log        ;标准输出的位置
stdout_logfile=/tmp/rabbitmq_worker_out.log        ;标准错误输出的位置

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Cocktail_py

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值