Supervisord无法让redis工作者继续工作,我的工作者仍然退出并使用卫星代码12并重新生成。我的redis容器位于应用程序的docker网络上(在主管所在的位置)
我遵循laravel的文档:https://laravel.com/docs/5.8/queues#supervisor-configuration
我试图守护命令并更新了一些代码 我也将Debian更新为Stretch和Docker 我在本地测试了所有内容,一切正常...
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/artisan queue:work redis --sleep=3 --tries=3
autostart=true
autorestart=true
user=www-data
numprocs=8
priority=10
redirect_stderr=true
stdout_logfile=/var/log/worker.log
api:
image: gitlab.ladechetterieduweb.com:5555/lddw/backend:latest
container_name: backend-lddw-develop
restart: always
working_dir: /var/www
volumes:
- ./config/api:/var/env
- ./app/storage:/var/www/storage
- ./logs/laravel:/var/www/storage/logs
- ./logs/supervisord:/var/log
depends_on:
- db
command: /bin/bash -c "cp /var/env/.env /var/www/.env && supervisord -c /etc/supervisord.conf --nodaemon"
networks:
- app-network
redis:
image: redis:5.0.3-stretch
restart: always
ports:
- 6379:6379
container_name: redis-lddw-develop
volumes:
- redis_data:/data
- ./config/redis:/usr/local/etc/redis
command: /bin/bash -c "cp /usr/local/etc/redis/rc.local /etc/rc.local && redis-server --appendonly yes"
networks:
- app-network
2019-06-25 21:50:15,199 CRIT Set uid to user 0
2019-06-25 21:50:15,199 WARN No file matches via include "/etc/supervisor/conf.d/*.conf"
2019-06-25 21:50:15,295 INFO RPC interface 'supervisor' initialized
2019-06-25 21:50:15,295 CRIT Server 'inet_http_server' running without any HTTP authentication checking
2019-06-25 21:50:15,457 INFO RPC interface 'supervisor' initialized
2019-06-25 21:50:15,457 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2019-06-25 21:50:15,457 INFO supervisord started with pid 1
2019-06-25 21:50:16,460 INFO spawned: 'php-fpm' with pid 10
2019-06-25 21:50:16,461 INFO spawned: 'laravel-worker_00' with pid 11
2019-06-25 21:50:16,463 INFO spawned: 'laravel-worker_01' with pid 12
2019-06-25 21:50:16,464 INFO spawned: 'laravel-worker_02' with pid 13
2019-06-25 21:50:16,467 INFO spawned: 'laravel-worker_03' with pid 14
2019-06-25 21:50:16,469 INFO spawned: 'laravel-worker_04' with pid 15
2019-06-25 21:50:16,472 INFO spawned: 'laravel-worker_05' with pid 16
2019-06-25 21:50:16,474 INFO spawned: 'laravel-worker_06' with pid 17
2019-06-25 21:50:16,476 INFO spawned: 'laravel-worker_07' with pid 18
2019-06-25 21:50:17,667 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-06-25 21:50:17,667 INFO success: laravel-worker_00 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-06-25 21:50:17,667 INFO success: laravel-worker_01 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-06-25 21:50:17,667 INFO success: laravel-worker_02 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-06-25 21:50:17,667 INFO success: laravel-worker_03 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-06-25 21:50:17,668 INFO success: laravel-worker_04 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-06-25 21:50:17,668 INFO success: laravel-worker_05 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-06-25 21:50:17,668 INFO success: laravel-worker_06 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-06-25 21:50:17,668 INFO success: laravel-worker_07 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_00 (exit status 12; not expected)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_02 (exit status 12; not expected)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_03 (exit status 12; not expected)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_05 (exit status 12; not expected)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_06 (exit status 12; not expected)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_07 (exit status 12; not expected)
答案 0 :(得分:1)
您的工人正在退出,状态为12:
2019-06-25 21:50:26,205 INFO exited: laravel-worker_00 (exit status 12; not expected)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_02 (exit status 12; not expected)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_03 (exit status 12; not expected)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_05 (exit status 12; not expected)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_06 (exit status 12; not expected)
2019-06-25 21:50:26,205 INFO exited: laravel-worker_07 (exit status 12; not expected)
当您的工作人员占用过多内存时,将触发此退出代码,请参阅: https://github.com/laravel/framework/blob/5.8/src/Illuminate/Queue/Worker.php#L204
$ this-> memoryExceeded($ options-> memory)返回true并退出。
您有2种选择,可以减少工作程序的内存占用空间或增加允许的工作空间。由于默认值非常低(128MB),因此您可以尝试添加一些内存。
要更改允许您的工作人员使用的内存,您必须编辑受监管的配置:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/artisan queue:work redis --sleep=3 --tries=3 --memory=1024
autostart=true
autorestart=true
user=www-data
numprocs=8
priority=10
redirect_stderr=true
stdout_logfile=/var/log/worker.log
在命令部分中查看我添加到conf中的--memory
致谢