为什么我收到此错误laravel-worker:错误(无此组)

时间:2019-02-21 15:48:55

标签: laravel queue centos7 supervisord supervisor

我遵循了Laravel官方文档,在 Centos 7 中使用超级用户在后台启动队列。

但是当我运行此命令sudo supervisorctl start laravel-worker:*时,我收到此错误laravel-worker: ERROR (no such group)

文档https://laravel.com/docs/5.5/queues#supervisor-configuration

3 个答案:

答案 0 :(得分:4)

我对其进行了测试,并创建了一个完全没有超级用户配置的新服务器。这些是我使其运行的步骤:

# 1. create the config file, see below for content
vi /etc/supervisor/conf.d/laravel-worker.conf

# 2. Reload the daemon's configuration files
supervisorctl reread
> laravel-worker: available

# 3. Reload config and add/remove as necessary
supervisorctl update
> laravel-worker: added process group

# 4. Start all processes of the group "laravel-worker"
supervisorctl start laravel-worker:*

# 5. Get status for all processes of the group "laravel-worker"
supervisorctl status laravel-worker:*
> laravel-worker:laravel-worker_00   RUNNING   pid 23758, uptime 0:00:16
> laravel-worker:laravel-worker_01   RUNNING   pid 23759, uptime 0:00:16

# 6. After a change in php sources you have to restart the queue, since queue:work does run as daemon
php artisan queue:restart
> Broadcasting queue restart signal.

/etc/supervisor/conf.d/laravel-worker.conf

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

答案 1 :(得分:0)

确保配置文件的顶部正确。示例:

[program:laravel-worker]

以下将导致您的问题:

[program: laravel-worker]
[laravel-worker]

欢呼

答案 2 :(得分:0)

我在基于云的vps上遇到同样的问题。请检查supervisord.conf文件的底部。

您可以在以下位置找到它

nano /etc/supervisord.conf

您应该在配置文件上携带[includes]部分。如果该部分如上所示。

[include]
files = supervisord.d/*.ini

改为将文件参数扩展名更改为 .conf

[include]
files = supervisord.d/*.conf

否则主管无法找到laravel-worker配置。