我正在使用celery处理django应用程序的异步任务,并使用主管来处理celery。
但是当我尝试通过主管运行它时,我在重新启动时得到以下日志
$ sudo tail -f /var/log/supervisor/supervisord.log
2019-07-04 13:08:19,298 CRIT received SIGTERM indicating exit request
2019-07-04 13:08:19,436 CRIT Supervisor running as root (no user in config file)
2019-07-04 13:08:19,441 INFO /var/tmp/supervisor.sock:Medusa (V1.1.1.1) started at Thu Jul 4 13:08:19 2019
Hostname: <unix domain socket>
Port:/var/tmp/supervisor.sock
2019-07-04 13:08:19,465 CRIT Running without any HTTP authentication checking
2019-07-04 13:08:19,466 DEBG supervisord forked; parent exiting
2019-07-04 13:08:19,466 INFO daemonizing the process
2019-07-04 13:08:19,466 INFO supervisord started with pid 21246
2019-07-04 13:08:19,467 INFO spawned: 'celery ' with pid 21248
2019-07-04 13:08:19,782 INFO exited: celery (exit status 1; not expected)
2019-07-04 13:08:19,783 INFO received SIGCLD indicating a child quit
2019-07-04 13:08:20,785 INFO spawned: 'celery ' with pid 21253
2019-07-04 13:08:21,066 INFO exited: celery (exit status 1; not expected)
2019-07-04 13:08:21,066 INFO received SIGCLD indicating a child quit
2019-07-04 13:08:23,070 INFO spawned: 'celery ' with pid 21260
2019-07-04 13:08:23,355 INFO exited: celery (exit status 1; not expected)
2019-07-04 13:08:23,355 INFO received SIGCLD indicating a child quit
2019-07-04 13:08:26,360 INFO spawned: 'celery ' with pid 21265
2019-07-04 13:08:26,638 INFO exited: celery (exit status 1; not expected)
2019-07-04 13:08:26,638 INFO received SIGCLD indicating a child quit
2019-07-04 13:08:27,639 INFO gave up: celery entered FATAL state, too many start retries too quickly
我们的配置文件
$ cat /etc/supervisord.conf
[supervisord]
http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server)
;http_port=127.0.0.1:9001 ; (alternately, ip_address:port specifies AF_INET)
;sockchmod=0700 ; AF_UNIX socketmode (AF_INET ignore, default 0700)
;sockchown=nobody.nogroup ; AF_UNIX socket uid.gid owner (AF_INET ignores)
;umask=022 ; (process file creation umask;default 022)
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=debug ; (logging level;default info; others: debug,warn)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[supervisorctl]
serverurl=unix:///var/tmp/supervisor.sock ; use a unix:// URL for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris ; should be same as http_username if set
;password=123 ; should be same as http_password if set
;prompt=mysupervisor ; cmd line prompt (default "supervisor")
[program:celery]
command=sudo celery -A myapp worker -l info --autoscale=3,2 --maxtasksperchild=1000
directory=/home/<user>/myapp
numprocs=1
stdout_logfile=/var/log/celery.log
stderr_logfile=/var/log/celery.log
autostart=true
autorestart=true
startsecs=100
startretries=3
user=root
如果我直接在终端下运行以下命令,它将正常工作。实际上,这就是screen
中当前运行的方式。
sudo celery -A myapp worker -l info --autoscale=3,2 --maxtasksperchild=1000
但是主管中的相同命令给出了上述错误。
有人可以帮忙吗?