+-
超级用户如何运行celery worker?
当我使用sudo运行celery worker时,出现以下错误:

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:

echo $C_FORCE_ROOT
true

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

我应该如何用sudo运行芹菜?我知道它并不安全,但出于某些原因,我确实需要这样做!

最佳答案
确定,我找到了解决方案!
在celery 3.1及更高版本中,具有pickle序列化的工人将崩溃,如 documentation中所述:

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

所以要使用sudo,您需要在celery配置中禁用pickle序列化.

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

然后,如果您使用sudo运行,它将起作用!

点击查看更多相关文章

转载注明原文:超级用户如何运行celery worker? - 乐贴网