幾個常用管理配置文件的區(qū)別
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
因為該隊列執(zhí)行時間超過一個小時觅玻,所有利用supervisord管理該隊列時培漏,執(zhí)行超過一小時后會報錯,并停止監(jiān)聽該隊列
[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的監(jiān)聽里
[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
執(zhí)行supervisorctl reread后
[root@mobileapp ~]# supervisorctl reread
EhrSyncTask: changed
效果不管用冷冗,可能會在下次重啟的時候才管用
執(zhí)行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
執(zhí)行成功