Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrate Celery Tasks from Redis to RabbitMQ

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.

like image 879
hanshoi Avatar asked Oct 20 '25 13:10

hanshoi


1 Answers

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
like image 54
hanshoi Avatar answered Oct 23 '25 03:10

hanshoi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!