启动芹菜工人作为守护进程



我正在尝试设置芹菜以在生产中运行。我一直按照这里的说明进行操作:

https://www.linode.com/docs/development/python/task-queue-celery-rabbitmq/#start-the-workers-as-daemons

我目前正在执行步骤#7,即"sudo systemctl start celeryd"。当我运行这个时,我被告知芹菜服务失败了。我已经运行了"journalctl -xe"来查找日志详细信息,我在下面复制了这些详细信息。

我对芹菜很陌生,所以我发现很难解释日志文件以找出出了什么问题,所以任何帮助将不胜感激。如果需要更多信息,请询问,我会尽力提供。

Apr 05 10:44:47 user-admin systemd[6477]: celeryd.service: Failed to determine user credentials: No such process
Apr 05 10:44:47 user-admin systemd[6477]: celeryd.service: Failed at step USER spawning /bin/sh: No such process
-- Subject: Process /bin/sh could not be executed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The process /bin/sh could not be executed and failed.
--
-- The error number returned by this process is 3.
Apr 05 10:44:47 user-admin systemd[1]: celeryd.service: Control process exited, code=exited status=217
Apr 05 10:44:47 user-admin systemd[1]: celeryd.service: Failed with result 'exit-code'.
Apr 05 10:44:47 user-admin systemd[1]: Failed to start Celery Service.
-- Subject: Unit celeryd.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit celeryd.service has failed.
--
-- The result is RESULT.
Apr 05 10:44:47 user-admin sudo[6472]: pam_unix(sudo:session): session closed for user root
Apr 05 10:45:01 user-admin CRON[6481]: pam_unix(cron:session): session opened for user root by (uid=0)
Apr 05 10:45:01 user-admin CRON[6482]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Apr 05 10:45:01 user-admin CRON[6481]: pam_unix(cron:session): session closed for user root
Apr 05 10:45:05 user-admin sudo[6485]: djangoadmin : TTY=pts/1 ; PWD=/var/log/celery ; USER=root ; COMMAND=/bin/journalctl -xe

从 ExecStart、ExecStop 和 ExecRestart(在您的 celeryd.service 中(中删除/bin/sh -c

假设您在 /home/celery/venv 中有一个虚拟环境,并且在此环境中安装了 Celery,那么您的 ExecStart(和其他 Exec* 行(应如下所示:

ExecStart=/home/celery/venv/bin/celery multi start ${CELERYD_NODES} 
  -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} 
  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} 
  ${CELERYD_OPTS}'

要创建虚拟环境,请执行以下操作: python3 -m venv /home/celery/venv

如果芹菜用户是在不同的路径中创建的,则将上面代码中的/home/celery更改为芹菜用户的相应"家"......

更新:如果您使用了与Linode页面上相同的配置文件,则可以使用ExecStart=${CELERY_BIN} multi start...

相关内容

  • 没有找到相关文章

最新更新