RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
centos下如何安装supervisor

这篇文章主要介绍centos下如何安装supervisor,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

莱阳网站建设公司创新互联,莱阳网站设计制作,有大型网站制作公司丰富经验。已为莱阳上1000家提供企业网站建设服务。企业网站搭建\外贸营销网站建设要多少钱,请找那个售后服务好的莱阳做网站的公司定做!

1、安装supervisor

执行以下命令

yum install python-setuptools
easy_install supervisor

或者

#如果easy_install不好使就从官方下载:
wget https://pypi.python.org/packages/80/37/964c0d53cbd328796b1aeb7abea4c0f7b0e8c7197ea9b0b9967b7d004def/supervisor-3.3.1.tar.gz
#然后通过python安装:
tar zxf supervisor-3.3.1.tar.gz
cd supervisor
python setup.py install

2、配置Supervisor

a.创建文件夹和配置文件

mkdir /etc/supervisor
echo_supervisord_conf > /etc/supervisor/supervisord.conf

b.修改/etc/supervisor/supervisord.conf文件内容
在文件结尾[include]节点处
把;files = relative/directory/*.ini

centos下如何安装supervisor

改为files = conf.d/*.conf

centos下如何安装supervisor

c.执行supervisorctl reload命令使配置文件生效。
d.在/etc/supervisor/下创建conf.d文件夹,及ProjectName.conf(以项目名称命名的)
e.打开laravel.conf文件,添加内容如下:

[program:laravel]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/php/bin/php /data/wwwroot/laravel/artisan queue:listen --tries=3
autostart=true
autorestart=true
user=www
numprocs=2
redirect_stderr=true
stdout_logfile=/data/wwwlogs/worker.log

3、运行supervisord,查看是否生效,执行以下命令:

#运行
supervisord -c /etc/supervisor/supervisord.conf
#查看进程 (ps -ef | grep ProjectName)
ps -ef|grep laravel

4、配置supervisord开机启动

a.在指定目录下创建文件supervisord.service

vim /usr/lib/systemd/system/supervisord.service

b.输入以下内容:

[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

c.执行以下命令:

systemctl enable supervisord

d.验证是否为开机启动:

#提示 enabled 表示成功
systemctl is-enabled supervisord

5、常用命令

service supervisord start #启动
service supervisord stop #停止
service supervisord status #状态
supervisorctl shutdown #关闭所有任务
supervisorctl stop|start program_name #启动或停止服务
supervisorctl status #查看所有任务状态

以上是centos下如何安装supervisor的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


网站栏目:centos下如何安装supervisor
网页URL:http://sczitong.cn/article/jgcejh.html