ChannelDB2

A Fast Way to Get Started with Websphere MQ for DB2 Active-Active Databases

at no additional cost. The main reason was to give DB2 a built-in solution for
active-active databases. Since a lot of DB2 people are new to Q Replication, I will show you how easy it is to set up a real-world configuration and give it a try.

 



 

Before You Start

 

 

the Client from ibm.com's DB2 pages without affecting your DB2 server.

 

Do It Yourself

 

 


 

<1) Bring up a DB2 Command window, create a temporary directory called myscripts under say C:, and switch to it:

 

mkdir c:\myscripts
cd \myscripts

 

If you are running Windows 7, make sure to run the DB2 command window as Administrator. Otherwise, you will get an authorization error in a later step.

 

<2) Copy and paste the commands below (explained later) into a new file called activemq.asnclp in C:\myscripts:

 

asnclp session set to q replication;
create mq script config type B
mqserver 1 name site1 mqhost "madsenc.svl.ibm.com" mqport "2414",
mqserver 2 name site2 mqhost "madsenc.svl.ibm.com" mqport "2415";

 

<3) Change "madsenc.svl.ibm.com" to the host name or IP address of your system (or 'localhost' if you prefer) and save the file.
<4) Issue the following command from your DB2 Command window:

 

asnclp -f activemq.asnclp

 

<5) From your DB2 command window, run the two batch files that were generated by the asnclp command*:

 

qrepl.site1.mq_windows.bat
qrepl.site2.mq_windows.bat

 

You should now have two running queue managers, one named SITE1 and one named SITE2, along with all the objects needed for them to send messages to each other.

 

6) You can verify that your queue managers are running by issuing the following command:

 

dspmq

 

The output from this command should read as follows:

 

QMNAME(SITE1) STATUS(Running)
QMNAME(SITE2) STATUS(Running)

 

7) You can verify the queues are correct using the DB2 Replication Center.

 

My next post will show you how you can use a command to verify that your MQ configuration is correct for Q Replication. In the mean time, you can use a user interface called the Replication Center. This requires you create a few tables for Q Replication and add some Q Replication definitions to them, but you do not have to run Q Replication just to verify queues. See how to do it in the ChannelDB2 video titled
Verifying MQ for Q Replication.

 

That's it! You completed the MQ set up!

 

What's in the File called activemq.asnclp ?

 

The most important statement in this file is the asnclp
Create MQ Script statement. The things you should know about it are the following:

 

  • The recommended name for your MQ server (queue manager) is the same as the database name it will be used with.
    • In my posts, I am using SITE1 and SITE2 as the database names.
    • This convention is not required. It is a best practice.

 

  • The command needs the host name or IP address for the system where each queue manager will be created.
    • In my posts, it is "madsenc.svl.ibm.com" for both queue managers because I am running both on one system.
    • Note that a best practice is to have each queue manager colocated with the DB2 server it is used with.

 

  • Each queue manager needs a TCP/IP port where it receives messages from the other queue manager.
    • Two port numbers are needed to differentiate the two MQ servers on the same system.
    • For this exercise, those are "2414" and "2415".

 

Understanding How to Use the Batch Files and Shell Scripts

 

 

If you run on UNIX/Linux systems, use the generated shell scripts instead of the batch files. For this example, run the qrepl.site1.mq_aixlinux.sh and qrepl.site2.mq_aixlinux.sh files.

 

 

Running with Two Separate Systems

 

 


 

 

  • Update the file called activemq.asnclp.
    • Have the first mqhost parameter of the Create MQ script command be one of the host names or IP addresses and the second mqhost parameter be the other.
  • Run each of the two generated batch files or shell scripts on the appropriate system.
    • In other words, run the site1 script on one system and the site2 script on the other.

  

<--
<*In step 5, you may see a syntax error that starts with message number AMQ8405 for one command. This can be ignored. It causes no problem. 

 

 

Views: 4260

Comment

You need to be a member of ChannelDB2 to add comments!

Join ChannelDB2

Featured Downloads

Try BLU Acceleration on Cloud

© 2019   Created by channeldb2.   Powered by

Badges  |  Report an Issue  |  Terms of Service