几个常用管理配置文件的区别
supervisorctl help reload
[root@mobileapp ~]# supervisorctl help reload
reload Restart the remote supervisord.
supervisorctl help reread
[root@mobileapp ~]# supervisorctl help reread
reread Reload the daemon's configuration files
supervisorctl help restart
[root@mobileapp ~]# supervisorctl help restart
restart <name> Restart a process
restart <gname>:* Restart all processes in a group
restart <name> <name> Restart multiple processes or groups
restart all Restart all processes
Note: restart does not reread config files. For that, see reread and update.
supervisorctl help update
[root@mobileapp ~]# supervisorctl help update
update Reload config and add/remove as necessary
update all Reload config and add/remove as necessary
update <gname> [...] Update specific groups
项目中的使用
[program:EhrSyncTask]
command=/opt/project/api/artisan queue:listen --queue=EhrAvaSyncQueue --timeout=3600
因为该队列执行时间超过一个小时,所有利用supervisord管理该队列时,执行超过一小时后会报错,并停止监听该队列
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process ""/usr/bin/php" artisan queue:work --queue="EhrAvaSyncQueue " --delay=0 --memory=128 --sleep=3 --tries=0" exceeded the timeout of 3600 seconds.
queue:listen [--queue[="..."]] [--delay[="..."]] [--memory[="..."]] [--timeout[="..."]] [--sleep[="..."]] [--tries[="..."]] [connection]
所以需要更改
[program:EhrSyncTask]
command=/opt/project/api/artisan queue:listen --queue=EhrAvaSyncQueue --timeout=3600
把3600变成7200或其他大值。
计划更改完成后,在不影响项目中其他队列的情况下,把更改后的配置加载到supervisord的监听里
[root@mobileapp ~]# ps -ef |grep EhrAvaSyncQueue
root 10101 10093 0 Jun05 ? 01:09:08 php /home/mobileoa-php/api/artisan queue:listen --queue=EhrAvaSyncQueue --timeout=3600
root 15886 10101 15 19:47 ? 00:00:00 /usr/bin/php artisan queue:work --queue=EhrAvaSyncQueue --delay=0 --memory=128 --sleep=3 --tries=0
root 15899 15315 0 19:47 pts/0 00:00:00 grep EhrAvaSyncQueue
执行supervisorctl reread后
[root@mobileapp ~]# supervisorctl reread
EhrSyncTask: changed
效果不管用,可能会在下次重启的时候才管用
执行supervisorctl update后
[root@mobileapp ~]# supervisorctl update
EhrSyncTask: stopped
EhrSyncTask: updated process group
然后ps -ef|grep EhrAvaSyncQueue
[root@mobileapp ~]# ps -ef |grep EhrAvaSyncQueue
root 16182 10093 0 19:48 ? 00:00:00 php /home/mobileoa-php/api/artisan queue:listen --queue=EhrAvaSyncQueue --timeout=7200
root 18103 16182 22 19:53 ? 00:00:00 /usr/bin/php artisan queue:work --queue=EhrAvaSyncQueue --delay=0 --memory=128 --sleep=3 --tries=0
root 18117 15315 0 19:53 pts/0 00:00:00 grep EhrAvaSyncQueue
执行成功