MQ-Advanced-pot

IBM MQ NativeHA In-Region Replication (IRR) on RHEL


Table of Contents


Return to Main Menu

1. Introduction

What is Native HA?
Native HA is a high availability solution that is available on container deployments of IBM® MQ and on Linux.

What is Native HA In-Region Replication (IRR)?
A Native HA In-Region Replication (IRR) configuration enables you to switch the running of a queue manager to a different Native HA configuration in a different location within the same region.

In this lab, you will investigate the process of configuring the NativeHA In-Region Replication (IRR) Queue Manager on RHEL Virtual Machines. Additionally, you will conduct testing in the Live environment, subsequently performing a failover to the Recovery environment and monitoring the transition of client connections from Live to Recovery. .

alt text


2. Workshop Environments

You need to reserve Techzone environment which will have 6 RHEL VMs, and 1 WIndows VM.
For this lab we will be using acemq1 and acemq4 for doing the MQ native HA IRR.
We will launch everything from the Windows image.

Click on the Windows image console to open it.

alt text


3. IRR Setup

  1. From the Windows console click on the CAD to get to the login page. Click on OK for the Business Use Notice

    alt text

  2. Login to the windows using techzone/IBMDem0s

    alt text

  3. From the Windows VM’s Console, open Putty program and open acemq1, acemq4 Virtual Machine sessions.

    alt text

  4. Arrange the windows on your desktop and you should have the 3 RH vms. Login to each VM using ibmuser/engageibm.

    alt text


3a. acemq1 - Create Live Queue Manager

  1. Run the following commands

    Create Queue Manager MQ01IR

    crtmqm -lr `hostname` -lf 8192 -lp 10 -ls 10 -p 1414 MQ01IR
    

    alt text


3b. acemq4 - Create Recovery Queue Manager

  1. Run the following commands

    Create Queue Manager MQ01IR on the Recovery side

    crtmqm -lr `hostname` -lf 8192 -lp 10 -ls 10 -p 1414 MQ01IR
    

    alt text


3c. acemq1 - Create TLS Certificates

  1. Run the below steps to enable TLS on Queue Manager.

    Create TLS certificates.

    runmqakm -keydb -create -db /var/mqm/qmgrs/MQ01IR/ssl/key.kdb -pw passw0rd -stash
    
    runmqakm -cert -create -db /var/mqm/qmgrs/MQ01IR/ssl/key.kdb -pw passw0rd -label selfsigned -dn CN=MQ01IR -size 2048
    
    sudo chown -R :mqm /var/mqm/qmgrs/MQ01IR/ssl/key.*
    
    sudo chmod g+r /var/mqm/qmgrs/MQ01IR/ssl/key.*
    

    alt text

  2. Copy all key.* files to acemq4 (Recovery) Virtual Machines using sftp.

    sftp ibmuser@acemq4
    
    mput /var/mqm/qmgrs/MQ01IR/ssl/key.* /var/mqm/qmgrs/MQ01IR/ssl
    
    quit
    

    alt text

3d. acemq4 - Update Certificate Permissions

  1. Run the following commands to grant access to key.* files.
    sudo chown -R :mqm /var/mqm/qmgrs/MQ01IR/ssl/key.*
    
    sudo chmod g+r /var/mqm/qmgrs/MQ01IR/ssl/key.*
    

    alt text


3e. acemq1 - Update Live qm.ini

  1. On VM acemq1, we will add the TLS parameters, NativeHARecoveryGroup stanza to qm.ini.

    You can run the following command to look at the current qm.ini file.

    cat /var/mqm/qmgrs/MQ01IR/qm.ini
    

    alt text

  2. run the following commands.

    cd ~/mqha-irr
    

    Run 1-qm-IRR.sh to enable Native HA IRR on the Live Region. The command will add Native HA configurations to qm.ini file.

    ./1-qm-IRR.sh
    

    alt text


  3. When done run the following command to verify that the qm.ini was updated correctly.

    cat /var/mqm/qmgrs/MQ01IR/qm.ini
    

    alt text


3f. acemq4 - Update Recovery qm.ini

  1. Run 2-qm-IRR.sh to enable Native HA IRR on the Recovery Region. The command will add Native HA configurations to qm.ini file.

    ./2-qm-IRR.sh
    

    Check qm.ini.

    cat /var/mqm/qmgrs/MQ01IR/qm.ini
    

    alt text

  2. Run below commands.

    cd ~/mqha-irr
    

    Enable Native HA IRR.

    ./2-qm-IRR.sh
    

    alt text

  3. When done run the following command on acemq4 instance to verify that the qm.ini was updated correctly.

    cat /var/mqm/qmgrs/MQ01IR/qm.ini
    

    alt text


3g. acemq1, acemq4 - Enable systemd Monitoring

  1. Reference:
    https://www.ibm.com/docs/en/ibm-mq/9.4.x?topic=ha-monitoring-restarting-ending-queue-manager-instances

    You can implement a method to ensure that the queue manager instances in the Native HA configuration are still running, and restart them if required.

  2. Run the following commands on each RHEL VM.

    ln -s /opt/mqm/samp/mqmonitor@.service /etc/systemd/system 
    
    sudo systemctl enable mqmonitor@MQ01IR
    
    sudo systemctl start mqmonitor@MQ01IR
    


    The Queue Manager should be active in one of Virtual Machines.

    dspmq -o nativeha -x
    

    alt text

3h. Disable Security

Run the following command, on the node where the queue manager is Active,
This will disable security and define the channel and local Queue used for testing.

   runmqsc MQ01IR
   ALTER QMGR CHLAUTH(DISABLED) CONNAUTH(' ')
   REFRESH SECURITY TYPE(CONNAUTH)
   DEFINE CHANNEL(NATIVEHACHL.SVRCONN) CHLTYPE(SVRCONN)
   DEFINE QLOCAL(APPQ) DEFPSIST(YES)
   quit

alt text


4. Testing In-Region Replication in Live Environment

4a. Put and Get messages (amqsphac, amqsghac)

  1. On the Windows VM Desktop
    Open the MQ-Labs folder and start the putter and getter batch files.

    alt text

    alt text

    alt text


5. Switching Roles

  1. We will now check the status on both Datacenter deployments. If this is the first time you should see Datacenter1 - Live and Datacenter2 - Recovery

    acemq1

    ./get-status.sh 
    

    alt text

    Let’s switch roles, which will make the Live to be Recovery and Recovery to be Live.

    ./3-switch-irr.sh
    

    You will also observe that the putter and getter programs will reconnect to the new active instance of the QMgr.

    alt text


  2. You can now run the ./get-status.sh again to see current status and then the ./5-switch-crr.sh to switch roles back.

    ./get-status.sh
    

    alt text

  3. Now, you can switch the roles back by running ./3-switch-CRR.sh to failover back to the Live data center.

    ./3-switch-irr.sh
    

6. Summary

Congratulations! At this point, you ought to be familiar with the process of configuring IBM MQ Native HA IRR in the Primary, and Recovery regions.

7. References

Native HA IRR:
https://www.ibm.com/docs/en/ibm-mq/10.0.x?topic=recovery-native-ha-irr

Example: Deploying a simple Native HA IRR configuration on Linux:
https://www.ibm.com/docs/en/ibm-mq/10.0.x?topic=nhi-example-deploying-simple-native-ha-irr-configuration-linux


Return to Main Menu