2015年10月14日星期三

AMQ_005:A-MQ 功能演示5:Master/Slave + Networks Broker 高可用可扩展架构

环境:JBoss A-MQ 6.0.0

组合一下Master/Slave Failover 和 Networks Broker,就诞生了现在的高可用可扩展架构。

(1)在root container下创建两个子container
fabric:container-create-child root AMQ-East 2
输出如下:
The following containers have been created successfully:
    Container: AMQ-East1.
    Container: AMQ-East2.

(2)在root container下创建两个子container
fabric:container-create-child root AMQ-West 2
输出如下:
The following containers have been created successfully:
    Container: AMQ-West1.
    Container: AMQ-West2.

(3)创建 East container,East container 由一对 master/slave broker 组成,属于 amq-east 组,并且和 amq-west broker 以networks方式连接
fabric:mq-create --group amq-east --networks amq-west --networks-username admin --networks-password admin --assign-container AMQ-East1,AMQ-East2 amq-east-profile
输出如下:
MQ profile amq-east-profile ready
Profile successfully assigned to AMQ-East1
Profile successfully assigned to AMQ-East2

(4)创建 West container,West container 由一对 master/slave broker 组成,属于 amq-west 组,并且和 amq-east broker 以networks方式连接
fabric:mq-create --group amq-west --networks amq-east --networks-username admin --networks-password admin --assign-container AMQ-West1,AMQ-West2 amq-west-profile
输出如下:
MQ profile amq-west-profile ready
Profile successfully assigned to AMQ-West1
Profile successfully assigned to AMQ-West2

(5)查看fabric集群情况
fabric:cluster-list
输出如下:
[cluster]                      [masters]                      [slaves]                       [services]
fusemq/amq-east                                                                            
   amq-east-profile            AMQ-East2                      AMQ-East1                      tcp://MaPingdeMacBook-Pro.local:57047
fusemq/amq-west                                                                            
   amq-west-profile           AMQ-West1                     AMQ-West2                      tcp://MaPingdeMacBook-Pro.local:57050
fusemq/a-mq-east                                                                           
   a-mq-east-broker            A-MQ-East                      -                              tcp://MaPingdeMacBook-Pro.local:55602
fusemq/a-mq-west                                                                           
   a-mq-west-broker           A-MQ-West                     -                              tcp://MaPingdeMacBook-Pro.local:55617

(6)生产者
java -jar mq-client.jar consumer --user admin --password admin --brokerUrl "discovery:(fabric:amq-west)"

(7)消费者
java -jar mq-client.jar producer --user admin --password admin --brokerUrl "discovery:(fabric:amq-east)"

参考文献:
1. https://github.com/FuseByExample/external-mq-fabric-client/blob/master/docs/fabric-ha-setup-master-slave.md

没有评论: