为什么主管不止一次处理一项工作?

时间:2017-12-06 13:47:14

标签: ubuntu-14.04 laravel-5.3 supervisord supervisor laravel-queue

我一直致力于Laravel (5.3)项目,我必须从多个网站抓取数据。

因此,为此我设置了queue jobs并为他们配置了supervisor

在将主管配置为仅运行1个进程之前,一切正常。

在档案

  

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

numprocs=1

当我将numprocs值分配给多于1时,主管执行作业2次或3次就会很奇怪。

以下是我的版本:

  • Ubuntu 14.04.2 LTS
  • Laravel 5.3
  • supervisord 3.0b2

以下是我的配置:

以下文件的配置为

  

/etc/supervisor/supervisor.conf

; supervisor config file

[unix_http_server]
file=/var/run/supervisor.sock   ; (the path to the socket file)
chmod=0700                       ; sockef file mode (default 0700)

[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

以下文件的配置为

  

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

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/myapp/artisan queue:work database --sleep=3 --tries=3
autostart=true
autorestart=true
user=hmabuzar
numprocs=25
redirect_stderr=true
stderr_events_enabled=true
stderr_logfile=/var/www/myapp/storage/logs/worker.error.log
stdout_logfile=/var/www/myapp/storage/logs/worker.log

0 个答案:

没有答案