Sunday 6 January 2013

Setting up WebSphere MQ


In this module, you will create all of the WebSphere® MQ objects for replication between a source and target. You start by creating the queue managers, which manage communication on the WebSphere MQ messaging system.
In this tutorial, unidirectional replication uses two queue managers. One queue manager will manage queues and messages for the source database, and the other will manage queues and messages for the target database.The following figure shows the SRC_QM queue manager at the source and TGT_QM queue manager at the target. The two queue managers interact with the Q Capture and Q Apply programs, queues, and channels to rapidly move data in the form of messages. The figure shows two paths for messages: one for replicated data and communication from the source, and one that the Q Apply program uses to communicate with the Q Capture program. The source-to-target channel is depicted as larger because it carries replicated transactions, which are the bulk of the messaging traffic.
Figure 1. WebSphere MQ queue managers, queues, and channels.

Learning objectives

Each of the lessons in this module show the appropriate sections of this figure to identify the queues and channels that you are creating at each phase of the setup.After you complete the lessons in this module, you will be able to:
  • Create the source and target queue managers.
  • Start the queue managers.
  • Create the source queues.
  • Create the target queues.
  • Create the WebSphere MQ channels.
  • Start the WebSphere MQ channels and listeners.

Creating the source and target queue managers

In this lesson, you will create and start the queue managers for the source and target systems.
Queue managers manage the queues and messages. Both the source and target systems require queue managers.To create and start the queue managers, type (or copy and paste) the following commands into an operating system command window:
  1. Create the source queue manager:
    crtmqm SRC_QM
  2. Create the target queue manager:
    crtmqm TGT_QM
  3. Start the source queue manager:
    strmqm SRC_QM
  4. Start the target queue manager:
    strmqm TGT_QM 
Now that you created and started the two queue managers, you can use them to create the queues and channels.

Creating the target queues

In this lesson, you define four queues at the source system.
queue is a data structure that is used to store messages. Each queue is owned by a queue manager.
You will use the SRC_QM queue manager to define four queues:
Send queue
This queue is a remote queue definition that the Q Capture program uses to direct messages that contain replicated data to the receive queue at the target.
Transmission queue
This queue holds messages before they cross the channel.
Administration queue
This queue is used by the Q Capture program to receive communications from the Q Apply program at the target.
Restart queue
This queue stores restart information for the Q Capture program.
Message queues at the source
To create the source queues:
  1. Start an interactive session with the SRC_QM queue manager:
    runmqsc SRC_QM
    Your command window changes from an operating system prompt to a runmqsc session, as the following figure shows.
    Figure 2. runmqsc prompt at the beginning of interactive session
    runmqsc session window
  2. Create the administration queue:
    DEFINE QLOCAL ('ADMINQ') DEFPSIST(YES)
    DEFPSIST(YES) means messages that use this queue are persistent; that is, they will be logged for recovery in case of a system failure or shutdown.
  3. Create the restart queue:
    DEFINE QLOCAL ('RESTARTQ') DEFPSIST(YES)
  4. Create the transmission queue:
    DEFINE QLOCAL('TGT_QM') USAGE(XMITQ) DEFPSIST(YES)
    In this step, you name the transmission queue after the remote queue manager (TGT_QM). This practice is optional, but can help you remember the destination for messages.
  5. Create the remote queue definition that points to the receive queue at the target:
    DEFINE QREMOTE('SENDQ') RNAME('RECVQ') RQMNAME('TGT_QM') XMITQ('TGT_QM') DEFPSIST(YES)
    A remote queue definition names the destination queue (RNAME), the destination queue manager (RQMNAME) and the transmission queue that will be used (XMITQ).
Next, you will create the queues at the target.

Creating the target queues

In this lesson, you define four queues at the target system.
You will use the TGT_QM queue manager to define four queues:
Receive queue
This queue receives messages from the Q Capture program.
Transmission queue
This queue holds the administrative messages before they cross the channel.
Administration queue
This queue is used by the Q Apply program to receive communications from the Q Capture program at the source.
Spill queue
This queue is a model queue definition. Spill queues are created dynamically to hold any transactions that arrive at the source while the target table is being loaded.

Figure 1. Message queues at the target
Four target queues
To create the target queues:
  1. Start an interactive session with the TGT_QM queue manager:
    runmqsc TGT_QM
  2. Create the receive queue:
    DEFINE QLOCAL('RECVQ') DEFPSIST(YES)
    DEFPSIST(YES) means messages that use this queue are persistent; that is, they will be logged for recovery in case of a system failure or shutdown.
  3. Create the target transmission queue:
    DEFINE QLOCAL('SRC_QM') USAGE(XMITQ) DEFPSIST(YES)
    In this step, you name the transmission queue after the remote queue manager (SRC_QM). This practice is optional, but can help you remember the destination for messages.
  4. Create the remote queue definition that points to the source administration queue:
    DEFINE QREMOTE('ADMINQ') RNAME('ADMINQ') RQMNAME('SRC_QM') XMITQ('SRC_QM') DEFPSIST(YES)
  5. Create the model queue definition for spill queues:
    DEFINE QMODEL('IBMQREP.SPILL.MODELQ') DEFSOPT(SHARED) MSGDLVSQ(FIFO) DEFTYPE(PERMDYN)
The source and target queues are ready. Next, you will create the channels to connect them.

 Creating WebSphere MQ channels

WebSphere® MQ uses channels to transmit messages between queue managers. In this lesson, you define the channels between the source and target queue managers in both directions.
Each channel has two ends: A sender channel that is defined within the originating queue manager, and a receiver channel that is defined within the destination queue manager.
Figure 1. Message channels between the source and target
Message channels from source to target and target to source
Important: To differentiate the channels for this tutorial, you need to identify two unused ports on your computer because both the source and target queue managers are on a single computer with one IP address. The default WebSphere MQ port is 1414. This tutorial uses ports 1450 and 1451, which are typically free. You can check whether the ports are available:
  • On Windows®, open the C:\WINNT\system32\drivers\etc\services file. Search for ports 1450 and 1451. If the ports are not listed, they are available to use.
  • On Linux® or UNIX®, run the command: cat /etc/services | egrep "1450|1451"
If these ports are already assigned, choose different ports and verify that they are available.
To define the channels:
  1. Define the channel objects at the source:
    1. If your runmqsc session with the TGT_QM queue manager is still active, use the END command.
    2. Determine the IP address of your computer.
      Windows: Use the ipconfig command.
      Linux or UNIX: Use the ifconfig -a command.
      Note: You can use the host name of your computer instead of the IP address (for example, localhost).
    3. Start an interactive session with the SRC_QM queue manager.
      runmqsc SRC_QM
    4. Define the sender channel from the SRC_QM queue manager to the TGT_QM queue manager. Use the TCP/IP transmission protocol.
      Important: Replace IP_address with the IP address of your computer and replace port with 1450 or the alternate port that you determined earlier.
      DEFINE CHL ('SRC_QM.TO.TGT_QM') CHLTYPE(SDR) TRPTYPE(TCP) CONNAME ('IP_address(port)') XMITQ('TGT_QM') DISCINT(0)
    5. Define a receiver channel at the SRC_QM queue manager from the TGT_QM queue manager.
      DEFINE CHL ('TGT_QM.TO.SRC_QM') CHLTYPE(RCVR) TRPTYPE(TCP)
  2. Define the channel objects at the target. Within the target queue manager, you will define a sender channel for communicating with the Q Capture program, and a receiver channel for transaction messages from the Q Capture program.
    1. If your runmqsc session with the SRC_QM queue manager is still active, use the END command to end the session.
    2. Start an interactive session with the TGT_QM queue manager.
      runmqsc TGT_QM
    3. Define a sender channel from the TGT_QM queue manager to the SRC_QM queue manager.
      Important: Replace IP_address with the IP address or host name of your computer and replace port with 1451 or the alternate port that you determined earlier.
      DEFINE CHL ('TGT_QM.TO.SRC_QM') CHLTYPE(SDR) TRPTYPE(TCP) CONNAME('IP_address(port)') XMITQ('SRC_QM') DISCINT(0)
    4. Define a receiver channel at the TGT_QM queue manager from the SRC_QM queue manager.
      DEFINE CHL ('SRC_QM.TO.TGT_QM') CHLTYPE(RCVR) TRPTYPE(TCP)
    5. Use the END command to end your runmqsc session with the TGT_QM queue manager.
At this point you created the WebSphere MQ objects that you will need to connect the source and target databases. In the next lesson, you will start the channels and the listeners.

Starting WebSphere MQ channels and listeners

In this lesson, you start your two WebSphere® MQ channels at the sender ends of each channel, and start a listener at the receiving ends of each channel to monitor for incoming messages.
Prerequisite: Make sure that the SRC_QM queue manager at the source and TGT_QM queue manager at the target are running by issuing these commands:
strmqm SRC_QM
strmqm TGT_QM
To start the WebSphere MQ channels and listeners:
  1. Start the listener at the source for the receiver end of the channel from the target, by using TCP/IP protocol for queue manager SRC_QM, port 1451 (if you used a port other than 1451 in lesson 1.4, substitute the appropriate port number in the command):
    runmqlsr -t tcp -m SRC_QM -p 1451
    Tip: On Windows®, you can also use the start runmqlsr command to open a new command window for the listener so that you can continue using your current command window. You can do the same thing on Linux® and UNIX® by adding a space and ampersand (&) to the end of the command.
  2. Start an interactive session with the SRC_QM queue manager.
    runmqsc SRC_QM
  3. Start the sender channel at the source.
    start channel (SRC_QM.TO.TGT_QM)
  4. Use the END command to stop the interactive session with the source queue manager.
    end
  5. Start the listener at the target for the receiver end of the channel from the source, by using TCP/IP protocol for queue manager TGT_QM, port 1450 (if you used a port other than 1450 in lesson 1.4, substitute the appropriate port number in the command):
    runmqlsr -t tcp -m TGT_QM -p 1450
  6. Start an interactive session with the TGT_QM queue manager.
    runmqsc TGT_QM
  7. Start the sender channel at the target.
    start channel (TGT_QM.TO.SRC_QM)
  8. Use the END command to stop the interactive session with the target queue manager.
    end
You set up and started the WebSphere MQ objects for unidirectional replication using two queue managers to simulate replication between two remote database. Next, you will set up the Q replication programs.

26 comments:

  1. Were a gaggle of volunteers as well as starting off a brand new gumption within a community. Your blog furnished us precious details to be effective on. You've got completed any amazing work!
    Java training in Bangalore |Java training in Rajaji nagar

    Java training in Bangalore | Java training in Kalyan nagar

    Java training in Bangalore | Java training in Kalyan nagar

    Java training in Bangalore | Java training in Jaya nagar

    ReplyDelete
  2. From your discussion I have understood that which will be better for me and which is easy to use. Really, I have liked your brilliant discussion. I will comThis is great helping material for every one visitor. You have done a great responsible person. i want to say thanks owner of this blog.
    Data Science Training in Indira nagar
    Data Science Training in btm layout
    Python Training in Kalyan nagar
    Data Science training in Indira nagar
    Data Science Training in Marathahalli | Data Science training in Bangalore

    ReplyDelete
  3. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post I would like to read this online Python training
    python training in chennai

    ReplyDelete
  4. Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
    Online DevOps Certification Course - Gangboard
    Best Devops Training institute in Chennai

    ReplyDelete

  5. Some us know all relating to the compelling medium you present powerful steps on this blog and therefore strongly encourage
    contribution from other ones on this subject while our own child is truly discovering a great deal.
    Have fun with the remaining portion of the year.

    Selenium training in bangalore | best selenium training in bangalore | advanced selenium training in bangalore

    ReplyDelete

  6. This is quite educational arrange. It has famous breeding about what I rarity to vouch.
    Colossal proverb. This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved.
    This arrange is synchronous s informative impolite festivity to pity. I appreciated what you ok extremely here.

    Selenium training in bangalore
    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training
    Selenium interview questions and answers


    ReplyDelete
  7. Attend The Python training in bangalore From ExcelR. Practical Python training in bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python training in bangalore.
    python training in bangalore

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic also visit Tableau Training videos l page and check for training

    ReplyDelete
  10. Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing, best online data science courses

    ReplyDelete
  11. Well explanation with great coding knowledge. This blog gonna helpful to many. I am expecting these kind blogs in future too.
    Websphere Message Broker Training in Bangalore

    ReplyDelete
  12. Really awesome blog and good information thanks for sharing with us.
    Data Science Course with Placements in Hyderabad

    ReplyDelete
  13. They're produced by the very best degree developers who will be distinguished for your polo dress creation. You'll find Ron Lauren inside an exclusive array which includes particular classes for men, women.
    data scientist training in hyderabad

    ReplyDelete
  14. I recently came across your article and have been reading along. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you.
    data science institutes in hyderabad

    ReplyDelete
  15. I like it very much . It is too much informative for me . I have learnt alot of things from there Azure Data Factory Training in Hyderabad

    ReplyDelete
  16. I've been reading your essay since I recently came across it. I want to say how much I admire your writing style and capacity for drawing people in and keeping them reading all the way through. I want to read more recent blogs and let you know what I think.
    B.Com Colleges In Hyderabad


    ReplyDelete