Laravel 5.7:Supervisorctl不会使用以下命令自动重新启动队列工作器 [英] Laravel 5.7 : Supervisorctl does not auto-restart queue worker with

查看:335
本文介绍了Laravel 5.7:Supervisorctl不会使用以下命令自动重新启动队列工作器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有主管来按照 laravel文档中的建议来管理队列通知. .我已经按照文档配置了主管,这是我的配置文件.

I have supervisor for managing queue notifications as suggested in the laravel documentation . I have configured the supervisor as per the documentation and here is my configuration file.

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/application/artisan queue:work --tries=3
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/application/storage/logs/worker/worker.log

这可以很好地工作,但是问题是一段时间后所有工作人员都停止了,即使有待完成的工作要完成也没有重新启动.

This works fine but the problem is after sometime all the workers stops and doesn't restart even though there is pending jobs to be completed.

我需要使用sudo supervisorctl start laravel-worker:*手动重新启动主管.

I need to manually restart the supervisor using sudo supervisorctl start laravel-worker:*.

如何解决?

Supervisorctl不会自动重新启动守护程序队列工作器挂起时这是类似的问题,但是给出的解决方案是我在这里使用的相同的东西.

Supervisorctl does not auto-restart daemon queue worker when hanging This is similar problem but the solution given there is the same thing i am using here.

任何人都可以帮忙吗?

推荐答案

您可以使用horizo​​n.地平线为您处理所有这一切. https://laravel.com/docs/5.8/horizo​​n

You could use horizon. horizon handles all this for you. https://laravel.com/docs/5.8/horizon

用于地平线的主管脚本示例:

Example supervisor script for horizon:

[program:horizon]
process_name=%(program_name)s
command=php /var/www/application/artisan horizon
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/var/www/application/storage/logs/horizon.log

还将此命令添加到您的部署过程中:

Also add this command to your deploy-process:

php artisan horizon:terminate

无需重新启动它,主管会为您完成.

No need to restart it, supervisor does that for you.

这篇关于Laravel 5.7:Supervisorctl不会使用以下命令自动重新启动队列工作器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆