IBM MQ Cluster Setup

Overview of Clusters

  • If you do not use clusters, your queue managers are independent and communicate using distributed queuing. 
  • If one queue manager needs to send messages to another it must have defined:
  1. transmission queue
  2. channel to the remote queue manager
  3. remote-queue definition for every queue to which it wants to send messages
  • If you group queue managers in a cluster, the queue managers can make the queues that they host available to every other queue manager in the cluster. 
  • Any queue manager can send a message to any other queue manager in the same cluster without the need for explicit channel definitions, remote-queue definitions, or transmission queues for each destination. 
  • Every queue manager in a cluster has a single transmission queue from which it can transmit messages to any other queue manager in the cluster. 
  • Each queue manager in a cluster needs to define only:
  1. One cluster-receiver channel on which to receive messages
  2. One cluster-sender channel with which it introduces itself and learns about the cluster

Cluster

  • A cluster is a network of queue managers that are logically associated in some way. 
  • The queue managers in a cluster may be physically remote. For example, they might represent the branches of an international chain store and be physically located in different countries. 
  • Each cluster within an enterprise should have a unique name.

Cluster queue manager

  • A cluster queue manager is a queue manager that is a member of a cluster.
  • A one queue manager may be a member of more than cluster.
  • Each cluster queue manager must have a name that is unique throughout all the clusters of which it is a member.
  • Cluster queue managers are autonomous. They have full control over queues and channels that they define. 
  • Their definitions cannot be modified by other queue managers (other than queue managers in the same queue-sharing group).
  • When you make or alter a definition on a cluster queue manager, the information is sent to the repository queue manager and the repositories in the cluster are updated accordingly.

Cluster queue

  • A cluster queue is a queue that is hosted by a cluster queue manager and made available to other queue managers in the cluster. 
  • The cluster queue manager makes a local queue definition for the queue specifying the name of the cluster that the queue is to be available in. 
  • This definition has the effect of advertising the queue to the other queue managers in the cluster.
  • The other queue managers in the cluster can put messages to a cluster queue without needing a corresponding remote-queue definition. 
  • A cluster queue can be advertised in more than one cluster.

Repository

  • A repository is a collection of information about the queue managers that are members of a cluster. 
  • This information includes queue-manager names, their locations, their channels, what queues they host, and so on. 
  • The information is stored in the form of messages on a queue called SYSTEM.CLUSTER.REPOSITORY.QUEUE.
  • Typically, two queue managers in a cluster hold a full repository. The remaining queue managers all hold a partial repository.

Repository queue manager

  • A repository queue manager is a cluster queue manager that holds a full repository. 
  • To ensure availability, you are recommended to set up two or more repository queue managers in each cluster. 
  • The repository queue managers receive information sent by the other queue managers in the cluster and update their repositories accordingly.
  • The repository queue managers send messages to each other to be sure that they are both kept up to date with new information about the cluster.

Full repository and partial repository

  • A repository queue manager hosts a complete set of information about every queue manager in the cluster. This set of information is called the repository or sometimes the full repository.
  • The other queue managers in the cluster inquire about the information in the full repositories and build up their own subsets of this information in partial repositories. 
  • A queue manager’s partial repository contains information about only those queue managers with which the queue manager needs to exchange messages
  • The queue managers request updates to the information they need, so that if it changes, the repository queue manager will send them the new information. For much of the time
  • A queue manager’s partial repository has all the information it needs to perform within the cluster. 
  • When a queue manager needs some additional information, it makes inquiries of the full repository and updates its partial repository. 
  • The queue managers use a queue called SYSTEM.CLUSTER.COMMAND.QUEUE to request and receive updates to the repositories.

Cluster-receiver channel

  • A cluster-receiver (CLUSRCVR) channel definition defines the receiving end of a channel on which a cluster queue manager can receive messages from other queue managers in the cluster. 
  • A cluster-receiver channel can also carry information about the cluster—information destined for the repository. 
  • The definition of a cluster-receiver channel has the effect of advertising that a queue manager is available to receive messages. 
  • You need at least one cluster-receiver channel for each cluster queue manager.

Cluster-sender channel

  • A cluster-sender (CLUSSDR) channel definition defines the sending end of a channel on which a cluster queue manager can send cluster information to one of the full repositories. 
  • The cluster-sender channel is used to notify the repository of any changes to the queue manager’s status, for example the addition or removal of a queue. 
  • It is also used to transmit messages.
  • The repository queue managers themselves have cluster-sender channels that point to each other. 
  • They use them to communicate cluster status changes to each other.
  • It is of little importance which repository a queue manager’s CLUSSDR channel definition points to. 
  • Once the initial contact has been made, further cluster-sender channels are defined automatically as necessary so that the queue manager can send cluster information to every repository, and messages to every queue manager.

Cluster transmission queue

  • Each cluster queue manager has a cluster transmission queue called SYSTEM.CLUSTER.TRANSMIT.QUEUE. 
  • The cluster transmission queue transmits all messages from the queue manager to any other queue manager that is in the same cluster.

Benefits

  • There are two quite different reasons for using clusters:

1. Reduced system administration.

  • As soon as you start to establish even a small cluster you will benefit from simplified system administration. 
  • Establishing a network of queue managers in a cluster involves fewer definitions than establishing a network that is to use distributed queuing. 
  • With fewer definitions to make, you can set up or change your network more quickly and easily, and the risk of making an error in your definitions is reduced.

2. Increased availability and workload balancing.

  • You may be content to use simple clusters and benefit from the easier system administration. 
  • It is not necessary or applicable in every case to consider the availability and workload balancing aspects. 
  • If you do choose to use more complicated clusters, you will benefit from scalability of the number of instances of a queue you can define, and therefore from greater availability.
  • Because you can define instances of the same queue on more than one queue manager the workload can be distributed throughout the queue managers in a cluster

Auto-definition of channels

  • When you use distributed queuing, a queue manager must have a definition for a sender channel before it can send a message to a remote destination. 
  • When a queue manager has joined a cluster by making its initial CLUSSDR andCLUSRCVR definitions, it does not need to make any other definitions for channels to other queue managers in the cluster. 
  • MQSeries automatically makes cluster-sender channel definitions when they are needed. 
  • When both the cluster-sender end and the cluster-receiver end of a channel are defined, the channel is started. 
  • An auto-defined channel remains active until it is no longer needed and is shut down using the normal disconnect-interval rules.
  • Auto-defined cluster-sender channels take their attributes from those specified in the corresponding cluster-receiver channel definition on the receiving queue manager. 
  • Even if there is a manually-defined cluster-sender channel, its attributes are automatically modified to ensure that they match those on the corresponding cluster-receiver definition. 
  • Beware, therefore, that you could, for example, define a CLUSRCVR without specifying a port number in the CONNAME parameter, whilst manually defining a CLUSSDR that does specify a port number. 
  • When the auto-defined CLUSSDR replaces the manually defined one, the port number (taken from the CLUSRCVR) becomes blank. 
  • The default port number would be used and the channel would fail.
  • You cannot modify an auto-defined cluster-sender definition.
  • Also, you cannot see automatically-defined channels using the DISPLAYCHANNEL command.
  • To see the auto-defined channels use the command DISPLAY CLUSQMGR(qmname), which displays information about all channels defined on the named queue manager. 
  • You can also use the command DISPLAY CHSTATUS(channelname) to display the status of the auto-defined CLUSSDR channel corresponding to the CLUSRCVR channel definition you created.

Auto-definition of remote queues

  • When you use distributed queuing, a queue manager that wants to put a message to a queue on a remote queue manager must have a remote-queue definition for that queue.
  • A queue manager in a cluster does not need a remote-queue definition for remote queues in the cluster. 
  • The cluster queue manager finds out the location of a remote queue (from the repository) and then adds routing information to the message and puts it on the cluster transmission queue. 
  • MQSeries automatically creates a definition equivalent to a remote-queue definition so that the message can be sent.
  • You cannot alter or delete an automatically-created remote-queue definition.
  • However, you can look at it using the DISPLAY QUEUE command with theCLUSINFO attribute. For example: DISPLAY QUEUE(*) CLUSINFO

Default Queue/Channel definitions on Cluster

  • SYSTEM.CLUSTER.REPOSITORY.QUEUE
    • Each queue manager in a cluster has a local queue called SYSTEM.CLUSTER.REPOSITORY.QUEUE. 
  • This queue is used to store all the repository information.
  • SYSTEM.CLUSTER.COMMAND.QUEUE
    • Each queue manager in a cluster has a local queue called SYSTEM.CLUSTER.COMMAND.QUEUE. 
    • This queue is used to carry messages to the repository. 
    • The queue manager uses this queue to send any new or changed information about itself to the repository queue manager and to send any requests for information about other queue managers.
  • SYSTEM.CLUSTER.TRANSMIT.QUEUE
    • Each queue manager has a definition for a local queue called SYSTEM.CLUSTER.TRANSMIT.QUEUE. 
  • This is the transmission queue for all messages to all queues and queue managers that are within clusters. SYSTEM.DEF.CLUSSDR
    • Each cluster has a default CLUSSDR channel definition called SYSTEM.DEF.CLUSSDR. 
  • This is used to supply default values for any attributes that you do not specify when you create a cluster-sender channel on a queue manager in the cluster. SYSTEM.DEF.CLUSRCVR
    • Each cluster has a default CLUSRCVR channel definition called SYSTEM.DEF.CLUSRCVR. 
  • This is used to supply default values for any attributes that you do not specify when you create a cluster-receiver channel on a queue manager in the cluster.

Cluster Setup Implementation with 4 QMGRS ( 2 FR and 2 PR ) .

Let us see what are the minimal definitions we need to create . Consider FR are also used for message processing for Applications .

Use the below command for above MQ QMGR and cluster creation . Here i am using single server for all QMGR’s in PROD environment ideally will have one QMGR per machine .

MQ CLuster Setup 
---------------------
QMGR Names
CLUSTERNAME: TEST
Full Repositories   : FR1,FR2
Partial Repostories : PR1,PR2
Listener
Channel Names :TO.<QMGRNAME> Ex:TO.FR1
CLUSTER QUEUE's :PR.QL & FR.QL

crtmqm FR1
strmqm FR1
ALTER QMGR REPOS(TEST)
DEFINE LISTENER(FR1.LST) TRPTYPE(TCP) PORT(11414) CONTROL(QMGR) 
start LISTENER(FR1.LST)
DEFINE CHANNEL(TO.FR2) CHLTYPE(CLUSSDR) CONNAME('172.31.14.154(11415') TRPTYPE(TCP) CLUSTER(TEST)
DEFINE CHANNEL(TO.FR1) CHLTYPE(CLUSRCVR) CONNAME('172.31.14.154(11414') TRPTYPE(TCP) CLUSTER(TEST)
DEFINE QL(FR.QL) CLUSTER(TEST)
crtmqm FR2
strmqm FR2
ALTER QMGR REPOS(TEST)
DEFINE LISTENER(FR2.LST) TRPTYPE(TCP) PORT(11415) CONTROL(QMGR) 
DEFINE CHANNEL(TO.FR1) CHLTYPE(CLUSSDR) CONNAME('172.31.14.154(11414') TRPTYPE(TCP) CLUSTER(TEST)
DEFINE CHANNEL(TO.FR2) CHLTYPE(CLUSRCVR) CONNAME('172.31.14.154(11415') TRPTYPE(TCP) CLUSTER(TEST)
DEFINE QL(FR.QL) CLUSTER(TEST)

crtmqm PR1
strmqm PR1
DEFINE LISTENER(PR1.LST) TRPTYPE(TCP) PORT(21414) CONTROL(QMGR)
start  LISTENER(PR1.LST) 
DEFINE CHANNEL(TO.FR1) CHLTYPE(CLUSSDR) CONNAME('172.31.14.154(11414') TRPTYPE(TCP) CLUSTER(TEST)
DEFINE channel(TO.PR1) CHLTYPE(CLUSRCVR) CONNAME('172.31.14.154(21414') TRPTYPE(TCP) CLUSTER(TEST)
DEFINE QL(PR.QL) CLUSTER(TEST)

crtmqm PR2
strmqm PR2
DEFINE LISTENER(PR1.LST) TRPTYPE(TCP) PORT(21415) CONTROL(QMGR) 
start LISTENER(PR1.LST)
DEFINE CHANNEL(TO.FR2) CHLTYPE(CLUSSDR) CONNAME('172.31.14.154(11415') TRPTYPE(TCP) CLUSTER(TEST)
DEFINE channel(TO.PR2) CHLTYPE(CLUSRCVR) CONNAME('172.31.14.154(21415') TRPTYPE(TCP) CLUSTER(TEST)
DEFINE QL(PR.QL) CLUSTER(TEST)

Since we have 4 QMGR’s and all in the same machine i use for loop to run one command on all the qmgrs

#Replace COMMAND with actual MQ command ex : dis chs(*)
for each in FR1 FR2 PR1 PR2 ; do 
 echo "COMMAND"|runmqsc $each
done

Display QMGR cluster information ,repository information etc

[mqm@ip-172-31-14-154 ~]$ for each in FR1 FR2 PR1 PR2 ; do  echo "dis clusqmgr(*) qmid qmtype status conname " |runmqsc $each; done
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR1.


     1 : dis clusqmgr(*) qmid qmtype status conname 
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(FR1)                           CHANNEL(TO.FR1)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(11414)
   QMID(FR1_2021-01-02_05.30.32)           QMTYPE(REPOS)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(FR2)                           CHANNEL(TO.FR2)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(11415)
   QMID(FR2_2021-01-02_05.30.36)           QMTYPE(REPOS)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(PR1)                           CHANNEL(TO.PR1)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(21414)
   QMID(PR1_2021-01-02_05.30.18)           QMTYPE(NORMAL)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(PR2)                           CHANNEL(TO.PR2)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(21415)
   QMID(PR2_2021-01-02_05.30.25)           QMTYPE(NORMAL)
   STATUS(RUNNING)                      
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR2.


     1 : dis clusqmgr(*) qmid qmtype status conname 
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(FR1)                           CHANNEL(TO.FR1)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(11414)
   QMID(FR1_2021-01-02_05.30.32)           QMTYPE(REPOS)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(FR2)                           CHANNEL(TO.FR2)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(11415)
   QMID(FR2_2021-01-02_05.30.36)           QMTYPE(REPOS)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(PR1)                           CHANNEL(TO.PR1)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(21414)
   QMID(PR1_2021-01-02_05.30.18)           QMTYPE(NORMAL)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(PR2)                           CHANNEL(TO.PR2)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(21415)
   QMID(PR2_2021-01-02_05.30.25)           QMTYPE(NORMAL)
   STATUS(RUNNING)                      
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager PR1.


     1 : dis clusqmgr(*) qmid qmtype status conname 
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(FR1)                           CHANNEL(TO.FR1)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(11414)
   QMID(FR1_2021-01-02_05.30.32)           QMTYPE(REPOS)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(FR2)                           CHANNEL(TO.FR2)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(11415)
   QMID(FR2_2021-01-02_05.30.36)           QMTYPE(REPOS)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(PR1)                           CHANNEL(TO.PR1)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(21414)
   QMID(PR1_2021-01-02_05.30.18)           QMTYPE(NORMAL)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(PR2)                           CHANNEL(TO.PR2)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(21415)
   QMID(PR2_2021-01-02_05.30.25)           QMTYPE(NORMAL)
   STATUS(INACTIVE)                     
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager PR2.


     1 : dis clusqmgr(*) qmid qmtype status conname 
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(FR1)                           CHANNEL(TO.FR1)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(11414)
   QMID(FR1_2021-01-02_05.30.32)           QMTYPE(REPOS)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(FR2)                           CHANNEL(TO.FR2)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(11415)
   QMID(FR2_2021-01-02_05.30.36)           QMTYPE(REPOS)
   STATUS(RUNNING)                      
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(PR1)                           CHANNEL(TO.PR1)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(21414)
   QMID(PR1_2021-01-02_05.30.18)           QMTYPE(NORMAL)
   STATUS(INACTIVE)                     
AMQ8441I: Display Cluster Queue Manager details.
   CLUSQMGR(PR2)                           CHANNEL(TO.PR2)
   CLUSTER(TEST)                           CONNAME(172.31.14.154(21415)
   QMID(PR2_2021-01-02_05.30.25)           QMTYPE(NORMAL)
   STATUS(RUNNING)                      
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
[mqm@ip-172-31-14-154 ~]$ 
  • QMTYPE(REPOS) means QMGR is a FULL Repository
  • QMTYPE(NORMAL) means QMGR is a Partial Repository

Check the channel status on all the QMGR’s . Check how may started and how many we created Physically .

mqm@ip-172-31-14-154 ~]$ for each in FR1 FR2 PR1 PR2 ; do  echo "dis chs(*) " |runmqsc $each; done
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR1.


     1 : dis chs(*) 
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.PR2)                         CHLTYPE(CLUSSDR)
   CONNAME(172.31.14.154(21415))           CURRENT
   RQMNAME(PR2)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.PR1)                         CHLTYPE(CLUSSDR)
   CONNAME(172.31.14.154(21414))           CURRENT
   RQMNAME(PR1)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR2)                         CHLTYPE(CLUSSDR)
   CONNAME(172.31.14.154(11415))           CURRENT
   RQMNAME(FR2)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR1)                         CHLTYPE(CLUSRCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(FR2)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR1)                         CHLTYPE(CLUSRCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(PR1)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR1)                         CHLTYPE(CLUSRCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(PR2)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR2.


     1 : dis chs(*) 
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.PR2)                         CHLTYPE(CLUSSDR)
   CONNAME(172.31.14.154(21415))           CURRENT
   RQMNAME(PR2)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.PR1)                         CHLTYPE(CLUSSDR)
   CONNAME(172.31.14.154(21414))           CURRENT
   RQMNAME(PR1)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR2)                         CHLTYPE(CLUSRCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(FR1)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR2)                         CHLTYPE(CLUSRCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(PR1)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR2)                         CHLTYPE(CLUSRCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(PR2)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR1)                         CHLTYPE(CLUSSDR)
   CONNAME(172.31.14.154(11414))           CURRENT
   RQMNAME(FR1)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager PR1.


     1 : dis chs(*) 
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.PR1)                         CHLTYPE(CLUSRCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(FR1)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.PR1)                         CHLTYPE(CLUSRCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(FR2)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR2)                         CHLTYPE(CLUSSDR)
   CONNAME(172.31.14.154(11415))           CURRENT
   RQMNAME(FR2)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR1)                         CHLTYPE(CLUSSDR)
   CONNAME(172.31.14.154(11414))           CURRENT
   RQMNAME(FR1)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager PR2.


     1 : dis chs(*) 
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.PR2)                         CHLTYPE(CLUSRCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(FR2)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.PR2)                         CHLTYPE(CLUSRCVR)
   CONNAME(172.31.14.154)                  CURRENT
   RQMNAME(FR1)                            STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR2)                         CHLTYPE(CLUSSDR)
   CONNAME(172.31.14.154(11415))           CURRENT
   RQMNAME(FR2)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
AMQ8417I: Display Channel Status details.
   CHANNEL(TO.FR1)                         CHLTYPE(CLUSSDR)
   CONNAME(172.31.14.154(11414))           CURRENT
   RQMNAME(FR1)                            STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
[mqm@ip-172-31-14-154 ~]$ 

Display Cluster queue on all the QMGR’s

[mqm@ip-172-31-14-154 ~]$ for each in FR1 FR2 PR1 PR2 ; do  echo "dis ql(*) all where ( cluster eq TEST )" |runmqsc $each; done
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR1.


     1 : dis ql(*) all where ( cluster eq TEST )
AMQ8409I: Display Queue details.
   QUEUE(FR.QL)                            TYPE(QLOCAL)
   ACCTQ(QMGR)                             ALTDATE(2021-01-02)
   ALTTIME(06.03.49)                       BOQNAME( )
   BOTHRESH(0)                             CLUSNL( )
   CLUSTER(TEST)                           CLCHNAME( )
   CLWLPRTY(0)                             CLWLRANK(0)
   CLWLUSEQ(QMGR)                          CRDATE(2021-01-02)
   CRTIME(06.03.49)                        CURDEPTH(0)
   CUSTOM( )                               DEFBIND(OPEN)
   DEFPRTY(0)                              DEFPSIST(NO)
   DEFPRESP(SYNC)                          DEFREADA(NO)
   DEFSOPT(SHARED)                         DEFTYPE(PREDEFINED)
   DESCR( )                                DISTL(NO)
   GET(ENABLED)                            HARDENBO
   IMGRCOVQ(QMGR)                          INITQ( )
   IPPROCS(0)                              MAXDEPTH(5000)
   MAXMSGL(4194304)                        MAXFSIZE(DEFAULT)
   MONQ(QMGR)                              MSGDLVSQ(PRIORITY)
   NOTRIGGER                               NPMCLASS(NORMAL)
   OPPROCS(0)                              PROCESS( )
   PUT(ENABLED)                            PROPCTL(COMPAT)
   QDEPTHHI(80)                            QDEPTHLO(20)
   QDPHIEV(DISABLED)                       QDPLOEV(DISABLED)
   QDPMAXEV(ENABLED)                       QSVCIEV(NONE)
   QSVCINT(999999999)                      RETINTVL(999999999)
   SCOPE(QMGR)                             SHARE
   STATQ(QMGR)                             TRIGDATA( )
   TRIGDPTH(1)                             TRIGMPRI(0)
   TRIGTYPE(FIRST)                         USAGE(NORMAL)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR2.


     1 : dis ql(*) all where ( cluster eq TEST )
AMQ8409I: Display Queue details.
   QUEUE(FR.QL)                            TYPE(QLOCAL)
   ACCTQ(QMGR)                             ALTDATE(2021-01-02)
   ALTTIME(06.04.08)                       BOQNAME( )
   BOTHRESH(0)                             CLUSNL( )
   CLUSTER(TEST)                           CLCHNAME( )
   CLWLPRTY(0)                             CLWLRANK(0)
   CLWLUSEQ(QMGR)                          CRDATE(2021-01-02)
   CRTIME(06.04.08)                        CURDEPTH(0)
   CUSTOM( )                               DEFBIND(OPEN)
   DEFPRTY(0)                              DEFPSIST(NO)
   DEFPRESP(SYNC)                          DEFREADA(NO)
   DEFSOPT(SHARED)                         DEFTYPE(PREDEFINED)
   DESCR( )                                DISTL(NO)
   GET(ENABLED)                            HARDENBO
   IMGRCOVQ(QMGR)                          INITQ( )
   IPPROCS(0)                              MAXDEPTH(5000)
   MAXMSGL(4194304)                        MAXFSIZE(DEFAULT)
   MONQ(QMGR)                              MSGDLVSQ(PRIORITY)
   NOTRIGGER                               NPMCLASS(NORMAL)
   OPPROCS(0)                              PROCESS( )
   PUT(ENABLED)                            PROPCTL(COMPAT)
   QDEPTHHI(80)                            QDEPTHLO(20)
   QDPHIEV(DISABLED)                       QDPLOEV(DISABLED)
   QDPMAXEV(ENABLED)                       QSVCIEV(NONE)
   QSVCINT(999999999)                      RETINTVL(999999999)
   SCOPE(QMGR)                             SHARE
   STATQ(QMGR)                             TRIGDATA( )
   TRIGDPTH(1)                             TRIGMPRI(0)
   TRIGTYPE(FIRST)                         USAGE(NORMAL)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager PR1.


     1 : dis ql(*) all where ( cluster eq TEST )
AMQ8409I: Display Queue details.
   QUEUE(PR.QL)                            TYPE(QLOCAL)
   ACCTQ(QMGR)                             ALTDATE(2021-01-02)
   ALTTIME(06.08.15)                       BOQNAME( )
   BOTHRESH(0)                             CLUSNL( )
   CLUSTER(TEST)                           CLCHNAME( )
   CLWLPRTY(0)                             CLWLRANK(0)
   CLWLUSEQ(QMGR)                          CRDATE(2021-01-02)
   CRTIME(06.08.15)                        CURDEPTH(0)
   CUSTOM( )                               DEFBIND(OPEN)
   DEFPRTY(0)                              DEFPSIST(NO)
   DEFPRESP(SYNC)                          DEFREADA(NO)
   DEFSOPT(SHARED)                         DEFTYPE(PREDEFINED)
   DESCR( )                                DISTL(NO)
   GET(ENABLED)                            HARDENBO
   IMGRCOVQ(QMGR)                          INITQ( )
   IPPROCS(0)                              MAXDEPTH(5000)
   MAXMSGL(4194304)                        MAXFSIZE(DEFAULT)
   MONQ(QMGR)                              MSGDLVSQ(PRIORITY)
   NOTRIGGER                               NPMCLASS(NORMAL)
   OPPROCS(0)                              PROCESS( )
   PUT(ENABLED)                            PROPCTL(COMPAT)
   QDEPTHHI(80)                            QDEPTHLO(20)
   QDPHIEV(DISABLED)                       QDPLOEV(DISABLED)
   QDPMAXEV(ENABLED)                       QSVCIEV(NONE)
   QSVCINT(999999999)                      RETINTVL(999999999)
   SCOPE(QMGR)                             SHARE
   STATQ(QMGR)                             TRIGDATA( )
   TRIGDPTH(1)                             TRIGMPRI(0)
   TRIGTYPE(FIRST)                         USAGE(NORMAL)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager PR2.


     1 : dis ql(*) all where ( cluster eq TEST )
AMQ8409I: Display Queue details.
   QUEUE(PR.QL)                            TYPE(QLOCAL)
   ACCTQ(QMGR)                             ALTDATE(2021-01-02)
   ALTTIME(06.09.49)                       BOQNAME( )
   BOTHRESH(0)                             CLUSNL( )
   CLUSTER(TEST)                           CLCHNAME( )
   CLWLPRTY(0)                             CLWLRANK(0)
   CLWLUSEQ(QMGR)                          CRDATE(2021-01-02)
   CRTIME(06.09.49)                        CURDEPTH(0)
   CUSTOM( )                               DEFBIND(OPEN)
   DEFPRTY(0)                              DEFPSIST(NO)
   DEFPRESP(SYNC)                          DEFREADA(NO)
   DEFSOPT(SHARED)                         DEFTYPE(PREDEFINED)
   DESCR( )                                DISTL(NO)
   GET(ENABLED)                            HARDENBO
   IMGRCOVQ(QMGR)                          INITQ( )
   IPPROCS(0)                              MAXDEPTH(5000)
   MAXMSGL(4194304)                        MAXFSIZE(DEFAULT)
   MONQ(QMGR)                              MSGDLVSQ(PRIORITY)
   NOTRIGGER                               NPMCLASS(NORMAL)
   OPPROCS(0)                              PROCESS( )
   PUT(ENABLED)                            PROPCTL(COMPAT)
   QDEPTHHI(80)                            QDEPTHLO(20)
   QDPHIEV(DISABLED)                       QDPLOEV(DISABLED)
   QDPMAXEV(ENABLED)                       QSVCIEV(NONE)
   QSVCINT(999999999)                      RETINTVL(999999999)
   SCOPE(QMGR)                             SHARE
   STATQ(QMGR)                             TRIGDATA( )
   TRIGDPTH(1)                             TRIGMPRI(0)
   TRIGTYPE(FIRST)                         USAGE(NORMAL)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
[mqm@ip-172-31-14-154 ~]$ 

We will see DEFBIND Here .

Specifies the binding to be used when an application specifies MQOO_BIND_AS_Q_DEF on the MQOPEN call. The options for this attribute are:

Specify DEFBIND(OPEN) to bind the queue handle to a specific instance of the cluster queue when the queue is opened. DEFBIND(OPEN) is the default for this attribute.

Specify DEFBIND(NOTFIXED) so that the queue handle is not bound to any instance of the cluster queue.

alter qlocal(FR.QL) CLUSTER(TEST)  DEFBIND(NOTFIXED)
Run above command to alter queue 

Now We will try to send message from PR to FR ,FR to PR Cluster Queue and see Message distribution ( Work Load Balancing )

I am using sample script created to send bulk messages

mqm@ip-172-31-14-154 tmp]$ cat put.sh 
 #!/bin/bash
 for i in `seq 1000` ; do
  echo "Sending $i message"
  echo "Test MSG $i" |/opt/mqm/samp/bin/amqsput FR.QL PR1 >/dev/null 2>&1
 done 
[mqm@ip-172-31-14-154 tmp]$
mqm@ip-172-31-14-154 tmp]$ sh put.sh 
Sending 1 message
Sending 2 message
Sending 3 message
Sending 4 message
Sending 5 message
Sending 6 message
Sending 7 message
Sending 8 message
.
.
Sending 998 message
Sending 999 message
Sending 1000 message
[mqm@ip-172-31-14-154 tmp]$ 
[mqm@ip-172-31-14-154 tmp]$ for each in FR1 FR2 ; do  echo "dis qs(FR.QL) "|runmqsc $each; done
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR1.


     1 : dis qs(FR.QL) 
AMQ8450I: Display queue status details.
   QUEUE(FR.QL)                            TYPE(QUEUE)
   CURDEPTH(500)                           CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR2.


     1 : dis qs(FR.QL) 
AMQ8450I: Display queue status details.
   QUEUE(FR.QL)                            TYPE(QUEUE)
   CURDEPTH(500)                           CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
[mqm@ip-172-31-14-154 tmp]$ 

Sent another 1000 messages using script see now

[mqm@ip-172-31-14-154 tmp]$ for each in FR1 FR2 ; do  echo "dis qs(FR.QL) "|runmqsc $each; done
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR1.


     1 : dis qs(FR.QL) 
AMQ8450I: Display queue status details.
   QUEUE(FR.QL)                            TYPE(QUEUE)
   CURDEPTH(1000)                          CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager FR2.


     1 : dis qs(FR.QL) 
AMQ8450I: Display queue status details.
   QUEUE(FR.QL)                            TYPE(QUEUE)
   CURDEPTH(1000)                          CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
[mqm@ip-172-31-14-154 tmp]$ 

Applicaitons connection to FR* can able to read/GET message from FR.QL and process then respond back to PR.QL for the Applicaton
Let us modify the script to connect to one of QMGR FR and try to put message to PR.QL Queue

mqm@ip-172-31-14-154 tmp]$ cat put.sh 
 #!/bin/bash
 for i in `seq 1000` ; do
  echo "Sending $i message"
  echo "Test MSG $i" |/opt/mqm/samp/bin/amqsput PR.QL FR1 >/dev/null 2>&1
 done 
[mqm@ip-172-31-14-154 tmp]$ 
mqm@ip-172-31-14-154 tmp]$ sh put.sh 
Sending 1 message
Sending 2 message
Sending 3 message
Sending 4 message
Sending 5 message
Sending 6 message
Sending 7 message
Sending 8 message
.
.
Sending 999 message
Sending 1000 message
[mqm@ip-172-31-14-154 tmp]$ 
mqm@ip-172-31-14-154 tmp]$ for each in PR1 PR2 ; do  echo "dis qs(PR.QL) "|runmqsc $each; done
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager PR1.


     1 : dis qs(PR.QL) 
AMQ8450I: Display queue status details.
   QUEUE(PR.QL)                            TYPE(QUEUE)
   CURDEPTH(500)                           CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager PR2.


     1 : dis qs(PR.QL) 
AMQ8450I: Display queue status details.
   QUEUE(PR.QL)                            TYPE(QUEUE)
   CURDEPTH(500)                           CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(1)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
[mqm@ip-172-31-14-154 tmp]$ 

Sending Again 1000 message by connecting to FR2 .

[mqm@ip-172-31-14-154 tmp]$ cat put.sh 
 #!/bin/bash
 for i in `seq 1000` ; do
  echo "Sending $i message"
  echo "Test MSG $i" |/opt/mqm/samp/bin/amqsput PR.QL FR2 >/dev/null 2>&1
 done 
[mqm@ip-172-31-14-154 tmp]$ 
mqm@ip-172-31-14-154 tmp]$ sh put.sh
Sending 1 message
Sending 2 message
Sending 3 message
Sending 4 message
Sending 5 message
Sending 6 message
Sending 7 message
Sending 8 message
.
.
.
Sending 998 message
Sending 999 message
Sending 1000 message
[mqm@ip-172-31-14-154 tmp]$
[mqm@ip-172-31-14-154 tmp]$
[mqm@ip-172-31-14-154 tmp]$ for each in PR1 PR2 ; do  echo "dis qs(PR.QL) "|runmqsc $each; done
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager PR1.


     1 : dis qs(PR.QL) 
AMQ8450I: Display queue status details.
   QUEUE(PR.QL)                            TYPE(QUEUE)
   CURDEPTH(1000)                          CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(2)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager PR2.


     1 : dis qs(PR.QL) 
AMQ8450I: Display queue status details.
   QUEUE(PR.QL)                            TYPE(QUEUE)
   CURDEPTH(1000)                          CURFSIZE(1)
   CURMAXFS(2088960)                       IPPROCS(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MEDIALOG( )                             MONQ(OFF)
   MSGAGE( )                               OPPROCS(2)
   QTIME( , )                              UNCOM(NO)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
[mqm@ip-172-31-14-154 tmp]$ 

Since we used DEFBIND(NOTFIXED) messages are distributed evenly in round robin fashion .
If the Application want to read the message then it has to GET from the QMGR where MQ Queue Physically exist .

NOTE: In MQ GET can only happen from the Local QUEUE in the QMGR . We cannot GET message from remote QMGR . This is Thump RULE .

If i read the messages from PR.QL PR2 ,PR.QL PR1 and see top few message . Nature of the message distribution is not guarenteed always because if one of the channel is not running based on Routing information available the messge will be delivered to the Available QMGR Queue .Ex if PR1 is down or not available due to network error then all the message will go to PR2 for PR.QL

[mqm@ip-172-31-14-154 tmp]$ /opt/mqm/samp/bin/amqsget PR.QL PR2
Sample AMQSGET0 start
message <Test MSG 1>
message <Test MSG 3>
message <Test MSG 5>
message <Test MSG 7>
message <Test MSG 9>
message <Test MSG 11>
message <Test MSG 13>
message <Test MSG 15>
.
.
[mqm@ip-172-31-14-154 tmp]$ /opt/mqm/samp/bin/amqsget PR.QL PR1
Sample AMQSGET0 start
message <Test MSG 2>
message <Test MSG 4>
message <Test MSG 6>
message <Test MSG 8>
message <Test MSG 10>
message <Test MSG 12>
message <Test MSG 14>
.
.

Hope This helps on How to create MQ cluster .

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *