hanshoi
hanshoi

Reputation: 136

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.

Upvotes: 4

Views: 1659

Answers (1)

hanshoi
hanshoi

Reputation: 136

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

Upvotes: 8

Related Questions