1、网上说:pip install supervisor
出现问题:bash:pip:command not found
需要安装pip:sudo easy_install pip
出现问题:sudo: easy_install: command not found
需要执行:sudo apt-get install python-setuptools
然后就可以:pip install supervisor
2、在supervisor默认配置中,其启动的sock等都会放到tmp目录,而tmp目录会自动清理(比如重启主机)导致无法使用supervisorctl命令;
修改supervisor.conf文件,修改到/var/run/及/var/log/目录
file=/var/run/supervisor.sock
serverurl=unix:///var/run/supervisor.sock ;
等等
*注意:修改supervisor.conf文件后,要执行supervisorctl reload
,重新加载配置文件;
*注意:supervisor好像需要root安装;
3、错误:Supervisorctl error: unix:///var/run/supervisord.sock refused connection?
说明需要开启supervisord。
echo_supervisord_conf > /etc/supervisord.conf
//如果已经修改了supervisor.conf,这句就不要执行了
sudo supervisord -c /etc/supervisord.conf
sudo supervisorctl status
4、supervisor自启动
其实自启动,也就是在主机开启的时候,执行了sudo supervisord -c /etc/supervisord.conf
;
创建/usr/lib/systemd/system/supervisord.service
文件;
写入:
# dservice for systemd (CentOS 7.0+)
# by ET-CS (https://github.com/ET-CS)
[Unit]
Description=Supervisor daemon
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
ExecStop=/usr/bin/supervisorctl shutdown
ExecReload=/usr/bin/supervisorctl reload
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
*注意:我的supervisord的目录是/usr/local/bin/supervisord,需要把上边目录修改;
将文件拷贝至:“/usr/lib/systemd/system/supervisord.service”
systemctl enable supervisord
验证一下是否为开机启动:systemctl is-enabled supervisord
clip_image002
解决方法:
find / -name supervisor.sock
unlink /name/supervisor.sock
unix:///var/run/supervisor.sock no such file
sudo touch /var/run/supervisor.sock
sudo chmod 777 /var/run/supervisor.sock
sudo service supervisor restart
网友评论