超级用户如何管理芹菜工人?

2024-05-14 03:48:50 发布

您现在位置:Python中文网/ 问答频道 /正文

当我用sudo运行celery workers时,我得到以下错误:

Running a worker with superuser privileges when the
worker accepts messages serialized with pickle is a very bad idea!

If you really want to continue then you have to set the C_FORCE_ROOT
environment variable (but please think about this before you do).

User information: uid=0 euid=0 gid=0 egid=0

另外,我的C_FORCE_ROOT环境变量是true

^{pr2}$

更多信息:
Python-->2.7.6
芹菜-->3.1.23(Cipater)
操作系统-->;Linux(Ubuntu 14.04)

我该怎么用sudo做芹菜?我知道这不安全,但出于某些原因,我真的需要这么做!在


Tags: thetoyou错误withsudorootrunning
1条回答
网友
1楼 · 发布于 2024-05-14 03:48:50

好吧,我找到了解决办法!
在celery 3.1及更高版本中,pickle序列化的工人将崩溃,如documentation

Worker will now crash if running as the root user with pickle enabled.

所以要使用sudo,需要在celery configs中禁用pickle序列化,我是用json实现的:

app.conf.update(
     CELERY_ACCEPT_CONTENT = ['json'],
     CELERY_TASK_SERIALIZER = 'json',
     CELERY_RESULT_SERIALIZER = 'json',
)

然后如果你用sudo运行,它会工作的!在

相关问题 更多 >