簡體   English   中英

啟動 supervisorctl 在 laravel 隊列工作進程上給出錯誤(生成錯誤)

[英]Starting supervisorctl gives ERROR (spawn error) on laravel queue worker process

所以我安裝了主管,它似乎正在運行。 我已將隊列工作程序的配置文件放在 /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 中使用了正確的配置。 我搜索了文檔和其他 stackoverflow 線程,但找不到解決方案

我通過重新啟動主管得到了解決

sudo service supervisor reload

所以問題顯然出在我的 laravel-worker 上,我需要通過在路徑中添加 '/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

我也面臨同樣的問題,在正確指定隊列名稱后問題已解決

command=php /home/vagrant/code/prject1/artisan queue:work redis --queue=email --sleep=3 --tries=1 --daemon

這是我的工作文件laravel-worker.conf

執行

您需要在您的 conf 中添加工匠並在您的 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

您可以通過查看日志文件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文件夾中的配置文件存在錯誤時出現此錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM