gpt4 book ai didi

Laravel 与 Supervisor 一起排队 - 进入 FATAL 状态,太多启动重试太快

转载 作者:行者123 更新时间:2023-12-04 22:18:11 26 4
gpt4 key购买 nike

我正在尝试将 Laravel 队列与主管一起使用,但该服务无法正常工作。我的 /var/log/supervisor/supervisord.log是:

2018-06-18 10:56:07,441 INFO spawned: 'laravel-worker_00' with pid 20838
2018-06-18 10:56:07,446 INFO spawned: 'laravel-worker_01' with pid 20839
2018-06-18 10:56:08,021 INFO exited: laravel-worker_01 (exit status 255; not expected)
2018-06-18 10:56:08,033 INFO gave up: laravel-worker_01 entered FATAL state, too many start retries too quickly
2018-06-18 10:56:08,033 INFO exited: laravel-worker_00 (exit status 255; not expected)
2018-06-18 10:56:09,034 INFO gave up: laravel-worker_00 entered FATAL state, too many start retries too quickly

我的配置 /etc/supervisord.d/laravel-worker.conf是:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php /var/www/my-project/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=root:root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/my-project/worker.log

当我尝试重新启动所有程序时:
$ sudo supervisorctl restart all
$ laravel-worker:laravel-worker_00: ERROR (abnormal termination)
$ laravel-worker:laravel-worker_01: ERROR (abnormal termination)

我是主管的新手,所以有人可以指导我吗?

最佳答案

您需要添加 startsecs = 0给您的 laravel-worker像这样配置:

[program:laravel-worker]     
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php /var/www/my-project/artisan queue:work --sleep=3 --tries=3
.....
startsecs = 0
startsecs默认为 1 秒,如果程序没有停留 1 秒,它将看到启动失败。将它设置为 0,这样程序就不需要在任何特定的时间内保持运行。您可以查看此 github 问题以获取更多信息: https://github.com/Supervisor/supervisor/issues/212

如果您在守护进程模式下运行队列 worker 会更好,使用 --daemon 标志: command=/usr/bin/php /var/www/my-project/artisan queue:work database --daemon --sleep=3 --tries=3
更改配置文件后,您可能需要运行 supervisorctl reload以使更改生效。

关于Laravel 与 Supervisor 一起排队 - 进入 FATAL 状态,太多启动重试太快,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50912491/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com