Multiple server environments with RabbitMQ and Celery
I have a Django-based service with Celery, using RabbitMQ as the broker. I want to install several environments on the same machine.
What's the best way of configuring Celery for each environment? Give each environment its own virtual host, so the Test environment will use ampq://celery:celery@localhost:5672/test and the Dev environment will use ampq://celery:celery@localhost:5672/dev?
Or use the same RabbitMQ virtual host and direct each environment to different queues - so that the dev environment's default queue is default.dev and the test environment's default queue is default.test?
Or set up two RabbitMQ instances?
Setting up 2 RMQ vhosts is the way to do it.
With only 1 vhost and using 2 queues you can send tasks to the environment you decide, but the control commands (shutdown, inspect, etc) will be sent to all the workers. If you use different vhosts the control commands will work as expected.