How to setup IBM MQ Multi instance queue manager with Microsoft Azure File Service - ibm-messaging/mq-azure GitHub Wiki

How to setup IBM MQ Multi-instance queue manager with Microsoft Azure File Service

Introduction

IBM MQ Multi-instance queue manager

IBM MQ multi-instance queue managers (MIQM) are instances of the same queue manager configured on different servers. Both instances use the same data & logs stored on shared drive. One instance of the queue manager is defined as the active instance and another instance is defined as the standby instance. If the active instance fails, the multi-instance queue manager restarts automatically on the standby server.

More about IBM MQ Multi-instance queue manager here: http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.con.doc/q018140_.htm?lang=en

Microsoft Azure File Service

Microsoft Azure File Service provides shared storage that can be accessed by both applications and virtual machines. Applications can use the standard and familiar file system APIs like ReadFile and WriteFile to access the storage.

More about Azure File Service here: https://azure.microsoft.com/en-in/documentation/articles/storage-dotnet-how-to-use-files/

This article describes the steps to setup IBM MQ multi-instance queue manager on Azure File Service.

Step 1: Create shared storage on Azure File Service

This section describes the steps to create a storage on Azure File Service.

1.Login to Azure Portal and select Storage on the left pane.

2.Click on and then click DATA SERVICES -> STORAGE -> QUICK CREATE as shown below

3.Provide a name in URL box for the storage. Chose an appropriate LOCATION and REPLICATION option for the storage. Please note the Azure File Service storage and virtual machines that use the storage must all bin in the same LOCATION. Virtual machines located in one location will not be able to access a Storage located in another location.

4.Then click on link to create the storage. Wait for the storage to go online.

5.Once the ibmmqhastorage storage goes online, click on the arrow to expand and display the dashboard.

By default the share will use Geo-Redudant as replication option. The secondary region for replication is displayed in the configuration page.

Note the full URL of the share.

6.Click on link at the bottom of the page to bring up Manage Access Keys panel and copy the Primary Access Keys

7.Ensure Azure SDK is installed on your machine, for example on your laptop. Open Azure PowerShell command prompt and run the following commands to create a share ibmmqhashare and a directory mqha under that share.

Replace <Primary Access Key> with your own Primary Access Key

$ctx=New-AzureStorageContext ibmmqhastorage <Primary Access Key>

$s = New-AzureStorageShare ibmmqhashare -Context $ctx

New-AzureStorageDirectory -Share $s -Path mqha

Step 2: Create Virtual Machines

The next step is to create two virtual machines where IBM MQ multi-instance queue managers will be running. One virtual machine will host an Active instance of queue manager while the other virtual machine will host the Standby instance of queue manager.

You can create both virtual machines in the same region as the primary region of Azure File Service. This type of setup allows faster disk access. There may be network latency if the virtual machines and Azure File Service are located in different regions.

You can also create one virtual machine in the same region as the primary region of Azure File Service while the second virtual machine can be created in the secondary region of Azure File Service. In case of a region failure both MQ queue manager and Azure File Service would fail over to their secondary.

Follow the steps documented at https://github.com/ibm-messaging/mq-azure/wiki/Getting-Started to create both virtual machines.

Step 3: Import Azure File Service Storage Credentials

The next step is to import credentials of the storage into both virtual machines.

Importing credentials into virtual machine allows applications to access the Azure File Service storage. It must be noted that credentials must imported for all users under whom applications will be run. IBM MQ queue manager processes typically run under MUSR_MQADMIN user id. But it’s possible to run under any other user who has same access rights as MUSR_MQADMIN. Hence credentials must be imported for user who administers queue manager as well as for user under which queue manager processes run.

In this article we will assume queue manager processes will run under MUSR_MQADMIN user. This user gets created during installation of MQ. Hence the password for MUSR_MQADMIN must be changed before storage credentials can be imported.

Step 3.1 – Change MUSR_MQADMIN password

1.Logon on to first virtual machine with administrator authority.

2.Open Computer Management control panel application.

3.Click on Users node under System Tools/Local Users and Groups to display local users on the right pane.

4.Select MUSR_MQADMIN user. Right click and select Set Password menu. Enter an appropriate password in the panel and press OK.

Step 3.2 – Change MUSR_MQADMIN password on IBM MQ Service

IBM MQ Windows service runs under MUSR_MQADMIN user. As the password for MUSR_MQADMIN has been changed, the new password must be provided to MQ service also.

1.Open Windows Services console through Control Panel\System and Security\Administrative Tools.

2.Locate IBM WebSphere MQ service. Stop the service if it is running.

3.Double click on the service to bring up Properties panel. Switch to Log On tab.

4.Enter the new Password and Confirm Password. Press OK to apply the changes.

5.Restart the service.

Step 3.3 – Import storage credentials

Follow these steps to import credentials logged in user and MUSR_MQADMIN

1.Open a command prompt and run below command. Replace with Primary Access Key of your share.

cmdkey /add:ibmmqhastorage.file.core.windows.net /user:ibmmqhastorage /pass:<Primary Access Key>

2.Login as MUSR_MQADMIN and import credentials. Use the runas command to start another command prompt under MUSR_MQADMIN user.

runas /user:MUSR_MQADMIN cmd.exe

Enter password for MUSR_MQADMIN. Another command prompt opens up after password verification. Run the below command again. Replace with Primary Access Key of your share.

cmdkey /add:ibmmqhastorage.file.core.windows.net /user:ibmmqhastorage /pass:<Primary Access Key>

Follow the above steps (3.1 through 3.3) on the second virtual machine to import credentials.

Step 4: Create multi-instance queue manager

This step involves creation of required directories on shared storage followed by creation of multi-instance queue manager.

Step 4.1 – Create directory for shared data and logs

1.On the first virtual machine open a command prompt to map a drive to storage.

net use z: \\ibmmqhastorage.file.core.windows.net\ibmmqhastorage /user:ibmmqhastorage <Primary Access Key>

2.Create directory for MQ data and logs. Run the following commands.

z:

cd mqha

md logs

md qmgrs

Step 4.2 – Create multi-instance queue manager.

1.Create active instance of queue manager

crtmqm -ld \\ibmmqhastorage.file.core.windows.net\ibmmqhashare\mqha\logs -md \\ibmmqhastorage.file.core.windows.net\ibmmqhashare\mqha\qmgrs QMHA1

2.Start the queue manager

strmqm QMHA1

3.After queue manager starts successfully, end the queue manager using

endmqm QMHA1

4.Run the following command

dspmqinf -o command QMHA1

The command output would look like this:

addmqinf -s QueueManager -v Name=QMHA1 -v Directory=QMHA1 -v Prefix=C:\ProgramData\IBM\MQ –v DataPath=\\ibmmqhastorage.file.core.windows.net\ibmmqhashare \MQHA\qmgrs\ QMHA1

Copy the output to clipboard. The command in the output will need to be run on the second virtual machine.

5.Switch to second virtual machine. Open a command prompt and run the command:

addmqinf -s QueueManager -v Name=QMHA1 -v Directory=QMHA1 -v Prefix=C:\ProgramData\IBM\MQ –v DataPath=\\ibmmqhastorage.file.core.windows.net\ibmmqhashare \MQHA\qmgrs\QMHA1

6.Switch to first virtual machine and start queue manager QMHA1 as active instance.

strmqm –x QMHA1

Wait till the command completes. Display the queue manager status with dspmq –m QMHA1 –x command. The output would look as below.

The value of INSTANCE attribute indicates the host where an instance of queue manager is running. The about output indicates the host where active instance is running.

7.Switch to second virtual machine and start the second instance

strmqm –x QMHA1

Wait till the command completes. Display the queue manager status using dspmq –m command

The command output displays the host names where Active and Standby instances running.

8.Switch to first virtual machine and run dspmq command again to display the status of queue manager instances.

This completes the multi-instance queue manager setup using Azure File Service storage. Next step is to test queue manager failover.

Step 5: Test failover

Now that multi-instance queue manager instances are running, it’s time to test failover.

1.On first virtual machine, run the command

endmqm –s QMHA1

This initiates failover. Display the status of queue manager instances using dspmq –m command

dspmq –m QMHA1 –x

The command output would look as below.

It is possible that queue manager instance states displayed might not change immediately. This is due to the failover process may not be complete yet and states have not been updated.

2.On second virtual machine, display the status.

3.On first virtual machine, start a standby instance again.

4.Display the status of queue manager instances.

The dspmq command output shows the location of both instances.

This completes the failover testing.

⚠️ **GitHub.com Fallback** ⚠️