I have 2 RabbitMQ clusters in separate datacenters. At this moment i need to shovel one of the exchanges from an one rabbit to the other. How can i achieve it?
2 Answers
The shovel plugin is the best fit for this task helping to reliably and continually move messages between clusters (or within the same cluster). This plugin is included in the RabbitMQ distribution and is easy to enable (it can be configured on one of the clusters):
rabbitmq-plugins enable rabbitmq_shovel
If you prefer UI enable the management plugin for the Management UI:
rabbitmq-plugins enable rabbitmq_shovel_management
The next step is to define the dynamic shovel itself (if you are planning to move messages between the clusters on a permanent basis then use the static shovel). Declaration of a shovel is defined pretty well in the documentation. Please take into account that you need to configure src-exchange
and dest-exchange
instead of src-queue
and dest-queue
.

- 4,074
- 22
- 28
-
Thanks for your analysis..Actually i have already configured declaration of shovel and shovel management .All the set up part is done from rabbit UI. Just i need to shovel messages from one rabit on one cluster to another rabit on another cluster . I need to check behavior while shoveling message ,So could you please guide me how to do shoveling of message from rabit UI – sekhar Sep 28 '20 at 06:04
-
Here is documentation regarding the shovel status https://www.rabbitmq.com/shovel.html#status-management If the shovel status is green than it is doing its job and messages should be coming to the destination exchange. – Sergii Zhevzhyk Sep 28 '20 at 22:03
-
I have already done set up ,But after setting up shovel still my shovel status shows "starting" .I checked my dest url and source url both are fine. But not sure why shovel status stuck with status "starting" – sekhar Oct 01 '20 at 00:03
To supplement on Sergii's answer, here is how I create a shovel from my production cluster to the test cluster.
call rabbitmqctl.bat set_parameter shovel [shovel_name] "{""src-protocol"": ""amqp091"", ""src-uri"":""amqp://[username]:[password]@localhost"", ""src-exchange"": ""[source_exchange]"", ""src-exchange-key"": ""#"", ""dest-protocol"": ""amqp091"", ""dest-uri"": ""amqp://[username]:[password]@[target_cluster_server]"", ""dest-exchange"": ""[target_exchange]""}"
It creates a dynamic shovel, which I prefer because it will automatically copy itself to other nodes in the source cluster.
You can provide multiple destinations in dest-uri, so if a target node is down the shovel will try another.
src-exchange-key
is because the source is a topic exchange.
I don't think there is any way to check the behaviour other than see if the target exchange receives what you'd expect.

- 2,662
- 3
- 24
- 33