启动 supervisorctl 在 laravel 队列工作进程上给出错误(生成错误)
Starting supervisorctl gives ERROR (spawn error) on laravel queue worker process
所以我安装了 supervisor,它似乎是 运行。
我已将队列工作程序的配置文件放在 /etc/supervisor/conf.d/laravel-worker.conf
中
看起来像这样
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html queue:work database --sleep=3 --tries=2 --daemon
autostart=true
autorestart=true
numprocs=4
redirect_stderr=true
stdout_logfile=/var/www/html/storage/logs/laravel.log
我的 supervisord.conf 看起来像这样
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0775 ; sockef file mode (default 0700)
chown=root
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
我在尝试启动进程时遇到错误 - 错误(生成错误)。
当我查看它显示的日志文件时 -
2017-05-28 22:21:20,697 INFO exited: laravel-worker_01 (exit status 0; not expected)
2017-05-28 22:21:20,702 INFO exited: laravel-worker_00 (exit status 0; not expected)
2017-05-28 22:21:20,704 INFO exited: laravel-worker_02 (exit status 0; not expected)
2017-05-28 22:21:20,706 INFO exited: laravel-worker_03 (exit status 0; not expected)
2017-05-28 22:21:23,711 INFO spawned: 'laravel-worker_00' with pid 16280
2017-05-28 22:21:23,713 INFO spawned: 'laravel-worker_01' with pid 16281
2017-05-28 22:21:23,715 INFO spawned: 'laravel-worker_02' with pid 16282
2017-05-28 22:21:23,719 INFO spawned: 'laravel-worker_03' with pid 16283
2017-05-28 22:21:23,772 INFO exited: laravel-worker_02 (exit status 0; not expected)
2017-05-28 22:21:23,774 INFO gave up: laravel-worker_02 entered FATAL state, too many start retries too quickly
2017-05-28 22:21:23,774 INFO exited: laravel-worker_01 (exit status 0; not expected)
2017-05-28 22:21:23,776 INFO gave up: laravel-worker_01 entered FATAL state, too many start retries too quickly
2017-05-28 22:21:23,776 INFO exited: laravel-worker_03 (exit status 0; not expected)
2017-05-28 22:21:23,777 INFO gave up: laravel-worker_03 entered FATAL state, too many start retries too quickly
2017-05-28 22:21:23,777 INFO exited: laravel-worker_00 (exit status 0; not expected)
2017-05-28 22:21:24,778 INFO gave up: laravel-worker_00 entered FATAL state, too many start retries too quickly
我已验证我的配置文件中的所有文件都存在。我不确定我在 laravel-worker.conf 中使用的配置是否正确。我搜索了文档和其他 Whosebug 线程,但找不到解决方案
所以问题显然出在我的 laravel-工人身上
我需要像这样在路径中添加“/artisan”来完成命令路径 -
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/artisan queue:work database --sleep=3 --tries=2 --daemon
您需要在您的 conf 中添加 artisan 并在您的 conf 文件中添加用户
例如
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/site.com/kernel/artisan queue:work --sleep=3 --
tries=3
autostart=true
autorestart=true
user=root
numprocs=10
redirect_stderr=true
stdout_logfile=/home/site.com/kernel/worker.log
我通过重启 supervisor 解决了问题
sudo service supervisor reload
我也面临同样的问题,在正确指定队列名称后问题已解决
command=php /home/vagrant/code/prject1/artisan queue:work redis --queue=email --sleep=3 --tries=1 --daemon
这是我的工作文件laravel-worker.conf
execution
您可以通过查看您的日志文件找出您遇到的错误类型
stdout_logfile=/var/www/html/storage/logs/laravel.log
如果您使用的是 Laravel 7 或更低版本,则在命令中传递选项时可能会遇到错误。就我而言,删除这些选项解决了问题。
更改此行:
command=php /var/www/html queue:work database --sleep=3 --tries=2 --daemon
为此:
command=php /var/www/html queue:work
当 /config
文件夹中的配置文件存在错误时,我遇到了这个错误。
所以我安装了 supervisor,它似乎是 运行。 我已将队列工作程序的配置文件放在 /etc/supervisor/conf.d/laravel-worker.conf
中看起来像这样
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html queue:work database --sleep=3 --tries=2 --daemon
autostart=true
autorestart=true
numprocs=4
redirect_stderr=true
stdout_logfile=/var/www/html/storage/logs/laravel.log
我的 supervisord.conf 看起来像这样
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0775 ; sockef file mode (default 0700)
chown=root
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
我在尝试启动进程时遇到错误 - 错误(生成错误)。
当我查看它显示的日志文件时 -
2017-05-28 22:21:20,697 INFO exited: laravel-worker_01 (exit status 0; not expected)
2017-05-28 22:21:20,702 INFO exited: laravel-worker_00 (exit status 0; not expected)
2017-05-28 22:21:20,704 INFO exited: laravel-worker_02 (exit status 0; not expected)
2017-05-28 22:21:20,706 INFO exited: laravel-worker_03 (exit status 0; not expected)
2017-05-28 22:21:23,711 INFO spawned: 'laravel-worker_00' with pid 16280
2017-05-28 22:21:23,713 INFO spawned: 'laravel-worker_01' with pid 16281
2017-05-28 22:21:23,715 INFO spawned: 'laravel-worker_02' with pid 16282
2017-05-28 22:21:23,719 INFO spawned: 'laravel-worker_03' with pid 16283
2017-05-28 22:21:23,772 INFO exited: laravel-worker_02 (exit status 0; not expected)
2017-05-28 22:21:23,774 INFO gave up: laravel-worker_02 entered FATAL state, too many start retries too quickly
2017-05-28 22:21:23,774 INFO exited: laravel-worker_01 (exit status 0; not expected)
2017-05-28 22:21:23,776 INFO gave up: laravel-worker_01 entered FATAL state, too many start retries too quickly
2017-05-28 22:21:23,776 INFO exited: laravel-worker_03 (exit status 0; not expected)
2017-05-28 22:21:23,777 INFO gave up: laravel-worker_03 entered FATAL state, too many start retries too quickly
2017-05-28 22:21:23,777 INFO exited: laravel-worker_00 (exit status 0; not expected)
2017-05-28 22:21:24,778 INFO gave up: laravel-worker_00 entered FATAL state, too many start retries too quickly
我已验证我的配置文件中的所有文件都存在。我不确定我在 laravel-worker.conf 中使用的配置是否正确。我搜索了文档和其他 Whosebug 线程,但找不到解决方案
所以问题显然出在我的 laravel-工人身上 我需要像这样在路径中添加“/artisan”来完成命令路径 -
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/artisan queue:work database --sleep=3 --tries=2 --daemon
您需要在您的 conf 中添加 artisan 并在您的 conf 文件中添加用户
例如
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/site.com/kernel/artisan queue:work --sleep=3 --
tries=3
autostart=true
autorestart=true
user=root
numprocs=10
redirect_stderr=true
stdout_logfile=/home/site.com/kernel/worker.log
我通过重启 supervisor 解决了问题
sudo service supervisor reload
我也面临同样的问题,在正确指定队列名称后问题已解决
command=php /home/vagrant/code/prject1/artisan queue:work redis --queue=email --sleep=3 --tries=1 --daemon
这是我的工作文件laravel-worker.conf
execution
您可以通过查看您的日志文件找出您遇到的错误类型
stdout_logfile=/var/www/html/storage/logs/laravel.log
如果您使用的是 Laravel 7 或更低版本,则在命令中传递选项时可能会遇到错误。就我而言,删除这些选项解决了问题。
更改此行:
command=php /var/www/html queue:work database --sleep=3 --tries=2 --daemon
为此:
command=php /var/www/html queue:work
当 /config
文件夹中的配置文件存在错误时,我遇到了这个错误。