源码安装Supervisor

python3启动

安装动态库

strings /lib64/libc.so.6 | grep ^GLIBC
ls -d /lib64/libc.so.6

https://pypi.org/project/setuptools/

# tar xzvf setuptools-18.3.2.tar.gz
# cd setuptools-18.3.2
# python setup.py install

https://pypi.org/project/meld3/

# tar zxvf meld3-1.0.2.tar.gz
# cd meld3-1.0.2
# python setup.py install

https://pypi.org/project/supervisor/

tar xf supervisor-4.2.2.tar.gz
yum install -y python-setuptools
cd supervisor-4.2.2 
python setup.py install

echo_supervisord_conf > /etc/supervisord.conf
supervisord -c /etc/supervisord.conf
ps aux | grep supervisord

配置

cat > /etc/supervisord.conf << EOF
; Sample supervisor config file.

[unix_http_server]
file=/var/run/supervisor.sock   ; (the path to the socket file)

[inet_http_server]
port=0.0.0.0:9001
username=admin
password=123456

[supervisord]
logfile=/var/log/supervisor/supervisord.log  ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB       ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10          ; (num of main logfile rotation backups;default 10)
loglevel=info               ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/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)

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket

[include]
files = supervisord.d/*.ini
files = /app/supervisord/supervisord.d/*.ini
EOF

mkdir -p /app/supervisord/{supervisord.d,logs}
mkdir /var/log/supervisor
mkdir /var/run/supervisor
chown -R app.app /var/run/supervisor
chown -R app.app /var/log/supervisor
chown -R app.app /app/supervisord/
supervisord -c /etc/supervisord.conf

配置开机自启动

cat > /etc/systemd/system/supervisord.service <<EOF
[Unit]
Description=Supervisor daemon

[Service]
ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
ExecStop=/usr/bin/supervisorctl \$OPTIONS shutdown
ExecReload=/usr/bin/supervisorctl \$OPTIONS reload
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target
EOF

vim /etc/supervisord.conf 
nodaemon=false    ; 加入开机自启动后改成 true

systemctl start supervisord.service
systemctl restart supervisord.service
systemctl status supervisord.service

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值