rabbitmq在高可用HA方面的方案總結
為了提高訊息傳遞交付的可用性,rabbitMQ有幾種叢集的方案,不同的方案有不同的優缺點
1、普通的叢集
rabbitMQ中的exchange和queue都包含meta、contents、state等資訊,exchange在叢集中的每個節點都儲存一份資料,
但是queue不一樣,queue在叢集中對於contents只儲存一份,其他節點只儲存meta資訊
為什麼只在一個節點儲存queue的contents,官方是這麼說的:
a、 Storage space—If every cluster node had a full copy of every queue, adding nodes
wouldn’t give you more storage capacity. For example, if one node could store
1 GB of messages, adding two more nodes would just give you two more copies
of the same 1 GB of messages.
b、 Performance—Publishing messages would require replicating those messages to
every cluster node. For durable messages, that would require triggering disk
activity on all nodes for every message. Your network and disk load would
increase every time you added a node, keeping the performance of the cluster
the same (or possibly worse).
主備方式(active,passive)只有一個節點處於服務狀態,可以結合pacemaker和ARBD,
shovel簡單從一個broker的一個佇列中消費訊息,且轉發該訊息到另一個broker的交換機。
這兩種方式用的比較少,這裡就不做介紹了。