我一直在从事Laravel (5.3)项目,我必须从多个网站抓取数据。
一切正常,直到我将主管配置为仅运行 1 个进程。
在文件中
/etc/supervisor/conf.d/laravel-worker.conf
numprocs=1
当我将 numprocs 值分配为大于 1 时,主管执行作业 2 次或 3 次的行为很奇怪。
以下是我的版本:
- Ubuntu 14.04.2 LTS
- 拉拉维尔 5.3
- 监督者 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