I\'d like to define mirroring for all my queues by default. I currently have to use rabbitmqctl once the node is up:
rabbit
To add more details to IvanD's answer, this is how I did it.
First: sudo nano /etc/rabbitmq/rabbitmq.config
(this command might be different depending on your OS)
[
{rabbit,
[
{default_vhost,<<"/">>},
{default_user,<<"someuser">>},
{default_pass,<<"somepassword">>},
{default_permissions, [<<".*">>, <<".*">>, <<".*">>]},
{default_user_tags, [administrator]}
]
},
{rabbitmq_management,
[{listener, [{port, 15672}]},
{load_definitions, "/etc/rabbitmq/rabbitmq_definitions.json"},
{http_log_dir, "/var/log/rabbitmq/management_http.log"}]
}
].
Then create the additional json: sudo nano /etc/rabbitmq/rabbitmq_definitions.json
(this command might be different depending on your OS).
Its content:
{
"vhosts":[
{"name":"/"}
],
"policies":[
{"vhost":"/","name":"ha","pattern":"", "definition":{"ha-mode":"all","ha-sync-mode":"automatic","ha-sync-batch-size":5}}
]
}
IMPORTANT NOTE: The ha-sync-batch-size is only supported in RabbitMQ versions above 3.6.0! https://www.rabbitmq.com/ha.html#sync-batch-size
If your Rabbit is older than that, remove the setting from the rabbitmq_definitions.json
.
I'm using Ubuntu 14.04 Trusty and RabbitMQ v.3.6.2.