From 646865079ac2d9cbdd12e6500a7423984b244037 Mon Sep 17 00:00:00 2001 From: Hiram Chirino Date: Wed, 6 Mar 2013 12:38:32 -0500 Subject: [PATCH] Include updated detailed instructions on how to setup an M/S networks using JBoss A-MQ. --- README.md | 61 ++++----------------------------------- fabric-ha-setup.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 56 deletions(-) create mode 100644 fabric-ha-setup.md diff --git a/README.md b/README.md index 7a5de6a..0a57106 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ External MQ-Fabric Client Demo ============================== -This project shows how to connect to Fuse MQ message brokers running in Fuse Fabric from JMS clients running outside of +This project shows how to connect to JBoss A-MQ message brokers running in Fuse Fabric from JMS clients running outside of Fuse Fabric (i.e. when the JMS client is not running within a Fabric-enabled Fuse ESB container). This project reuses the classes and resources from Fuse By Example's "Getting Started with ActiveMQ" project to -demonstrate the minimal changes necessary to discover and connect to Fuse MQ brokers deployed within Fuse Fabric. +demonstrate the minimal changes necessary to discover and connect to JBoss A-MQ brokers deployed within Fuse Fabric. The Getting Started with ActiveMQ project uses broker URL's like this: @@ -78,7 +78,7 @@ To build the example, execute the command: Running the example against a default fabric broker ------------------------------------------------------------------- -Make sure a default instance of Fuse MQ message broker is running in the local fabric; if not, see below for +Make sure a default instance of JBoss A-MQ message broker is running in the local fabric; if not, see below for instructions on how to deploy a default broker. To start the default consumer, open a shell, change to the project root and run the command: @@ -92,7 +92,7 @@ After the consumer is running, open another shell, change to the project root an Here are some console messages you should see from the consumer when running the example: ****************************** - Connecting to Fuse MQ Broker using URL: discovery:(fabric:default) + Connecting to JBoss A-MQ Broker using URL: discovery:(fabric:default) ****************************** Using local ZKClient Client environment:zookeeper.version=3.4.3-1240972... @@ -115,8 +115,7 @@ Running the example against a fabric-based network of brokers ------------------------------------------------------------- Start a fabric-based network of fault-tolerant (master/slave) brokers. For instructions on how to configure and deploy -such a network, see the blog post [here](http://fusebyexample.blogspot.com/2012/06/using-fuse-management-console-and-fuse.html). -Summary instructions are also included below. +such a network, see the [fabric-ha-setup.md](https://github.com/FuseByExample/external-mq-fabric-client/blob/master/fabric-ha-setup.md). This configuration features two broker groups networked together, named "mq-east" and "mq-west", each of which is comprised of a master/slave pair (four brokers total). Consumers will connect to the active broker in the "mq-west" @@ -157,53 +156,3 @@ watch the producer failover, reconnect and resume sending messages, with console then kill the container MQ-West1 and observe similar failover and reconnection by the consumer. -Deploying a default Fuse MQ message broker in fabric ----------------------------------------------------------------------- - -Here are brief instructions on how to deploy a default instance of Fuse MQ message broker in fabric: - -* Launch Fuse Management Console (FMC), e.g. `bin/fmc`. FMC info and downloads are -[here](http://fusesource.com/products/fuse-management-console) - * Note: with a clean install of FMC, you will need to edit the `etc/users.properties` to include an *admin* userid - with password *admin* and role *admin*. The entry should look like `admin=admin,admin`. - -* Connect to FMC in a browser (e.g. http://localhost:8107), create a fabric if one does not yet exist using the -following credentials, and then login (you may need to provide Username/Password you just entered). - * Username = *admin* - * Password = *admin* - * ZooKeeper Password = *admin* - -* Click the “Create Fuse Container” button, name the container MQ (the name is not critical), click Next, select the -“mq” profile, click Next, select “Child container”, click Next, select “FuseManagementConsole” as the parent, and click -Finish. The broker instance will be registered in fabric in the default group. - -Deploying a fabric-based network of fault-tolerant message brokers --------------------------------------------------------------------------------------- - -Here are brief instructions on deploying a fabric-based network of fault-tolerant (master/slave) message brokers. See -the blog post [here](http://fusebyexample.blogspot.com/2012/06/using-fuse-management-console-and-fuse.html) for a more -complete description. - -* Launch Fuse Management Console (FMC). - -* Connect to FMC in a browser, create a fabric if one does not yet exist and login using *admin* | *admin* credentials. - -* Execute the following four commands one at a time in the FMC terminal: - - Note: the `profile-edit` commands add the username/password for the broker being connected to. That is, for the - "mq-east-broker" profile, the username and password of the mq-west-broker must be provided. In this example, since - everything is a child container, they will pickup the user.properties of the parent container, i.e. fmc, but if you - were networking to a different server with different user settings, you need to make specify those settings. - -``` - mq-create --group mq-east --networks mq-west mq-east-broker - profile-edit -p org.fusesource.mq.fabric.server-mq-east-broker/network.userName=admin mq-east-broker - profile-edit -p org.fusesource.mq.fabric.server-mq-east-broker/network.password=admin mq-east-broker - - mq-create --group mq-west --networks mq-east mq-west-broker - profile-edit -p org.fusesource.mq.fabric.server-mq-west-broker/network.userName=admin mq-west-broker - profile-edit -p org.fusesource.mq.fabric.server-mq-west-broker/network.password=admin mq-west-broker - - container-create-child --profile mq-east-broker FuseManagementConsole MQ-East 2 - container-create-child --profile mq-west-broker FuseManagementConsole MQ-West 2 -``` diff --git a/fabric-ha-setup.md b/fabric-ha-setup.md new file mode 100644 index 0000000..8403ecb --- /dev/null +++ b/fabric-ha-setup.md @@ -0,0 +1,71 @@ +# Deploying Complex JBoss A-MQ Networks + +This document provides details on how to configure and deploy a network +of JBoss A-MQ master/slave networked brokers. We will use the Fuse Management Console (FMC) to simplify configuring and deploying the configuration to multiple broker JVMs. + +Download and unpack a JBoss A-MQ distribution if you haven't already. +Launch A-MQ by running `bin/a-mq` or `bin\a-mq.bat`. You should see a +terminal session. Install the FMC by running: `fabric:create -p fmc`. +It will prompt you to create an admin user if you had not already +defined one in `etc/users.properties`. The rest of this document will assume you have set the user/password combination to admin/admin. + +Keep the terminal session running, and connect to +`http://localhost:8181/index.html` in a web browser. Once connected +login using the admin userid that you setup. You should see the +Containers page, with one active container (for the JVM that is running +the FMC) + +Click the Profiles tab and have a look at some of the profiles that +already exist, like the mq and mq-base profiles. Profiles aggregate +sets of features, bundles, repositories, properties and configs; when +you assign a profile to a container everything referenced by the +profile is provisioned to the container. So if you just wanted to stand +up a message broker, you could simply assign the pre-existing mq +profile to a container. For this example, we want to create a complex +message broker configuration, so we'll create our own profiles. + +We could easily create our custom profiles using the FMC GUI, but we'll +do it even faster by executing some Fuse Fabric commands from the FMC +command line. Information about Fuse Fabric is located here. Docs on +the commands we'll use are here. + +Lets start by creating two containers to hold a master/slave broker +pair for an East region, and two containers to hold a master/slave +broker pair for a West region. As I'm running this all on one machine, +I'll make them all child containers (JVMs) of the initial JVM that is +running the FMC. Note that default name of that initial container is +'root'. + +Execute this command from the FMC terminal session to create containers +named MQ-East1 and MQ-East2: + + container-create-child root MQ-East 2 + +Execute this command to create containers named MQ-West1 and MQ-West2: + + container-create-child root MQ-West 2 + +Execute this command (all on one line) to provision the East containers +with a master/slave broker pair identified with the group name +"mq-east", and networked to the mq-west brokers: + + mq-create --group mq-east --networks mq-west --networks-username admin -networks-password admin --assign-container MQ-East1,MQ-East2 mq-east-broker + +Execute this command (all on one line) to provision the West containers +with a master/slave broker pair identified with the group name +"mq-west", and networked to the mq-east brokers: + + mq-create --group mq-west --networks mq-east --networks-username admin -networks-password admin --assign-container MQ-West1,MQ-West2 mq-west-broker + +At this point, our network of brokers -- four instances of JBoss A-MQ, each running in its own container, networked together and with failover -- is up and running! + +To verify if everything is working properly lets test running some messages over the new deployment. We can use the mq-client.jar that's used to verify a standalone server. + +First lets start a consumer running against a broker running in the 'mq-west' group: + + java -jar lib/mq-client.jar consumer --user admin --password admin --brokerUrl 'discovery:(fabric:mq-west)' + +Then lets start a producer running against a broker running in the 'mq-east' group: + +java -jar lib/mq-client.jar producer --user admin --password admin --brokerUrl 'discovery:(fabric:mq-east)' +