RabbitMQ master and slave sync


You can determine which slaves are synchronised with the          following rabbitmqctl invocation:

rabbitmqctl list_queues name slave_pids synchronised_slave_pids

       

You can manually synchronise a queue with:

rabbitmqctl sync_queue name

       

And you can cancel synchronisation with:

rabbitmqctl cancel_sync_queue name

                 These features are also available through the management plugin



例如:


[root@TEST1 ~]# rabbitmqctl list_queues pid slave_pids synchronised_slave_pids
Listing queues ...
<[email protected]>    [<[email protected]>]    [<[email protected]>]

MASTER:rabbit@TEST2

SLAVE:rabbit@TEST1


在rabbit@TEST2上停止master,即rabbitmqctl stop_app

[root@TEST1 ~]# rabbitmqctl list_queues pid slave_pids synchronised_slave_pids
Listing queues ...
<[email protected]>    []    []

原来的slave已经成为了master,即master为rabbit@TEST1


在rabbit@TEST2上执行rabbitmqctl start_app

[root@TEST1 ~]# rabbitmqctl list_queues pid slave_pids synchronised_slave_pids
Listing queues ...
<[email protected]>    [<[email protected]>]    [<[email protected]>]

MASTER:rabbit@TEST1

SLAVE:rabbit@TEST2


结论:

broker master和slave能够正常切换


你可能感兴趣的:(master,broker,and,slave切换)