简体   繁体   中英

Celery: running a worker with superuser privileges

I've started a celery process using runit as a user not the root. When I look at svlogd logs I see:

2014-07-05_10:07:44.10586 Running a worker with superuser privileges when the
2014-07-05_10:07:44.10589 worker accepts messages serialized with pickle is a very bad idea!
2014-07-05_10:07:44.10589 
2014-07-05_10:07:44.10589 If you really want to continue then you have to set the C_FORCE_ROOT
2014-07-05_10:07:44.10589 environment variable (but please think about this before you do).
2014-07-05_10:07:44.10589 
2014-07-05_10:07:44.10590 User information: uid=0 euid=0 gid=0 egid=0

It seems that celery is running as root but when I run ps aux, it's actually running as the intended user:

jwes     2046  0.0  1.1 226172 45260 ?        S    19:01   0:00 /home/jwes/.virtualenvs/my-app/bin/python manage.py celeryd -E -l INFO -B
fezah     2047  0.0  1.1 217784 43008 ?        S    19:01   0:00 /home/jwes/.virtualenvs/my-app/bin/python manage.py celeryd -E -l INFO -B

Anybody have a clue how to solve this

Using this answer from another SO thread. I added the following settings

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

And it seemed to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM