3
votes

I'm changing my Celery backend from redis to rabbitmq. I can get the new broker working with changing my BROKER_URL. However I'm wondering how to migrate existing scheduled tasks from redis to rabbitmq broker?

I would like to do this by Python script if possible.

1
Is there anything you've tried or dug up in your search for an answer to this? - theMayer
Apparently there is tool for celery called 'migrate'. It should do the trick. Haven't been able to verify it yet though. If it works I'll make an answer about it. - hanshoi

1 Answers

6
votes

Celery provides following commands by default.

celery -b "redis://<url>:<port>/<db>" inspect scheduled > scheduled_tasks.txt
celery migrate "redis://<url>:<port>/<db>" "amqp://<username>:<password>@<url>:<port>/<vhost>"
celery -b "amqp://<username>:<password>@<url>:<port>/<vhost>" inspect scheduled  > post_migration_scheduled_tasks.txt
diff scheduled_tasks.txt post_migration_scheduled_tasks.txt