If you’re planning to migrate a queue manager, from one machine to another, or perhaps you’re consolidating some queue managers onto an MQ Appliance, you are probably aware of, and have even become familiar with, the steps required to export your object definitions and recreate them on the new queue manager. There are a number of tools available that can do this for you – including those from MQGem.
What about your messages though?
While it’s generally a good idea to reduce the load, and drain off as many messages as you can prior to migrating a queue manager. For example if it’s in a cluster, suspend it from the cluster before the move, to reduce the number of messages heading its way. Let all the applications drain the queues of messages and so on. However, it’s not always possible to drain every last message from all your queues.
In the latest version of QLOAD, V9.0.1, there’s a new feature that will help out when migrating a queue manager. It allows you to unload the messages from all your queues, with one command. And then you can load the messages onto the queues on another queue manager, with one command (or piecemeal if you prefer). You would combine this with your favoured object definition export tool, and before loading the messages, you’d first recreate the queues on the new queue manager with the exported commands.
Here’s an example of QLOAD unloading all the queues on my queue manager.
qload -m MQG1 -i* -f*
The command will produce the following output to show what has been unloaded. Using the -i (lower case) flag means that the messages are only browsed on the queues and are not destructively removed.
APP1.INPUT 2 Done. APP1.RESULT 10 Done. APP2.INPUT 1 Done. APP2.RESULT 4 Done. Q1 28 Done. Q2 42 Done. SYSTEM.ADMIN.QMGR.EVENT 7 Done. SYSTEM.AUTH.DATA.QUEUE 126 Done. SYSTEM.CHANNEL.SYNCQ 3 Done. SYSTEM.CHLAUTH.DATA.QUEUE 5 Done. SYSTEM.CLUSTER.REPOSITORY.QUEUE 3 Done. SYSTEM.DURABLE.SUBSCRIBER.QUEUE 1 Done. SYSTEM.HIERARCHY.STATE 2 Done. SYSTEM.INTER.QMGR.FANREQ 1 Done. SYSTEM.RETAINED.PUB.QUEUE 2 Done. WORK.REQUEST 7 Done. Total : 7 Queues, 94 Messages plus : 9 System Queues, 150 Messages
Listing the directory where I ran the qload command, I can now see I have a file for each queue, with an extension .qld. If you prefer to have a different extension then you can alter the command accordingly. For example, use -f*.txt.
I can copy these files to another machine, or simply use a client connection to the other machine accordingly. Then I can run the following QLOAD command to load the messages onto the new queue manager.
qload -m MQG1 -o* -f*
QLOAD will make some checks when you run a load for multiple queues in this way. It will check that all the queues exist that it has files for in the directory matching the file pattern you specified (which assumes an extension of .qld if you just use ‘*’), and it will check that all those queues are empty. If it finds any problems it will report as follows:-
APP1.RESULT RC(2085) Unknown object name. APP2.RESULT Not empty. There are potential problems with these queues. Are you sure you want to continue?
This lets you know to go and define the missing queues if you need them – there are messages to go onto them so the assumption is that you do need them. It also warns you of non-empty queues. Now if you’ve already started using this queue manager, you might be expecting this situation, but otherwise, you should rectify it, and then re-run QLOAD.
APP1.INPUT 2 Done. APP1.RESULT 10 Done. APP2.INPUT 1 Done. APP2.RESULT 4 Done. Q1 28 Done. Q2 42 Done. WORK.REQUEST 7 Done. Total : 7 Queues, 94 Messages
You’ll notice that this output does not mention the SYSTEM queues that were offloaded. A generic upload will not upload most SYSTEM queues.
SYSTEM.CLUSTER.TRANSMIT.QUEUE and SYSTEM.DEAD.LETTER.QUEUE are the exceptions. The messages were unloaded to files though, so if you really need to load them you can do so the traditional way, by specifying the full queue name on the command and not using the generic upload.
The new version can be downloaded from the QLOAD Download Page. Any current licensed users of QLOAD can run the new version on their existing licence. If you don’t have a licence and would like to try out QLOAD then send an email to firstname.lastname@example.org and a 1-month trial licence will be sent to you.