Federated Exchanges:联盟交换模式图下图
Federation插件,使得不同集群的节点之间可以传递消息,从而模拟出类似集群的效果。这样可以有几点好处:
松耦合:联合在一起的不同集群可以有各自的用户,权限等信息,无需一致;此外,这些集群的RabbitMQ和Erlang的版本可以不一致。
消息发布到上游队列服务节点upstream exchange 的同时会把消息复制到下游的federated exchange队列节点。
upstream exchange与federated exchange不必在同一个节点或在同一集群。实质上upstream exchange会把交换器或者队列绑定到federated exchange服务器的交换器或者队列上,并把消息复制到federated exchange服务器上。
远程网络连接友好:由于通信是遵循AMQP协议的,故而对断断续续的网络连接容忍度高。
如何开始?
前提需要安装插件[Federation plugin]
windows安装
rabbitmq-plugins enable rabbitmq_federation
rabbitmq-plugins enable rabbitmq_federation_management
linux安装
进入到队列服务节点:
rabbitmq-plugins enable rabbitmq_federation
root@fcjrabbit1:/# rabbitmq-plugins enable rabbitmq_federation
Enabling plugins on node rabbit@fcjrabbit1:
rabbitmq_federation
The following plugins have been configured:
rabbitmq_federation
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@fcjrabbit1...
The following plugins have been enabled:
rabbitmq_federation
rabbitmq-plugins enable rabbitmq_federation_management
Enabling plugins on node rabbit@fcjrabbit1:
rabbitmq_federation_management
The following plugins have been configured:
rabbitmq_federation
rabbitmq_federation_management
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@fcjrabbit1...
The following plugins have been enabled:
rabbitmq_federation_management
started 1 plugins.
root@fcjrabbit1:/#
安装成功后,打开web监控界面,在选项admin看到federation的信息
定义Federation策略
定义上游节点参数
下游节点IP更改后,集群信息不会丢失