[UNIX, Linux, Windows, IBM i]

Sharing IBM MQ files on Multiplatforms

Some IBM® MQ files are accessed exclusively by an active queue manager, other files are shared.

IBM MQ files are split into program files and data files. Program files are typically installed locally on each server running IBM MQ. Queue managers share access to data files and directories in the default data directory. They require exclusive access to their own queue manager directory trees contained in each of the qmgrs and log directories shown in Figure 1.

Figure 1 is a high-level view of the IBM MQ directory structure. It shows the directories which can be shared between queue managers and made remote. The details vary by platform. The dotted lines indicate configurable paths.

Figure 1. Overall view of IBM MQ directory structure
Simplified view of directory structure, showing directories that can be shared between running queue managers, and ones that cannot.
Program files

The program files directory is typically left in the default location, is local, and shared by all the queue managers on the server.

Data files

The data files directory is typically local in the default location, /var/mqm on UNIX and Linux® systems and configurable on installation on Windows. It is shared between queue managers. You can make the default location remote, but do not share it between different installations of IBM MQ. The DefaultPrefix attribute in the IBM MQ configuration points to this path.

qmgrs
There are two alternative ways to specify the location of queue manager data.
Using Prefix

The Prefix attribute specifies the location of the qmgrs directory. IBM MQ constructs the queue manager directory name from the queue manager name and creates it as a subdirectory of the qmgrs directory.

The Prefix attribute is located in the QueueManager stanza, and is inherited from the value in the DefaultPrefix attribute. By default, for administrative simplicity, queue managers typically share the same qmgrs directory.

The QueueManager stanza is in the mqs.ini file.

If you change the location of the qmgrs directory for any queue manager, you must change the value of its Prefix attribute.

The Prefix attribute for the QM1 directory in Figure 1 for a UNIX and Linux platform is,

Prefix=/var/mqm
Using DataPath

The DataPath attribute specifies the location of the queue manager data directory.

The DataPath attribute specifies the complete path, including the name of the queue manager data directory. The DataPath attribute is unlike the Prefix attribute, which specifies an incomplete path to the queue manager data directory.

The DataPath attribute, if it is specified, is located in the QueueManager stanza. If it has been specified, it takes precedence over any value in the Prefix attribute.

The QueueManager stanza is in the mqs.ini file.

If you change the location of the queue manager data directory for any queue manager you must change the value of the DataPath attribute.

The DataPath attribute for the QM1 directory in Figure 1 for a UNIX or Linux platform is,

DataPath=/var/mqm/qmgrs/QM1
log

The log directory is specified separately for each queue manager in the Log stanza in the queue manager configuration. The queue manager configuration is in qm.ini.

DataPath/QmgrName/@IPCC subdirectories

The DataPath/QmgrName/@IPCC subdirectories are in the shared directory path. They are used to construct the directory path for IPC file system objects. They need to distinguish the namespace of a queue manager when a queue manager is shared between systems..

The IPC file system objects have to be distinguished by system. A subdirectory, for each system the queue manager runs on, is added to the directory path, see Figure 2.

Figure 2. Example IPC subdirectory

DataPath/QmgrName/@IPCC/esem/myHostName/
myHostName is up to the first 20 characters of the host name returned by the operating system. On some systems, the host name might be up to 64 characters in length before truncation. The generated value of myHostName might cause a problem for two reasons:
  1. The first 20 characters are not unique.
  2. The host name is generated by a DHCP algorithm that does not always allocate the same host name to a system.
In these cases, set myHostName using the environment variable, MQS_IPC_HOST ; see Figure 3.
Figure 3. Example: setting MQS_IPC_HOST

export MQS_IPC_HOST= myHostName
Other files and directories

Other files and directories, such as the directory containing trace files, and the common error log, are normally shared and kept on the local file system.

With support of shared file systems, IBM MQ manages exclusive access to these files using file system locks. A file system lock allows only one instance of a particular queue manager to be active at a time.

When you start the first instance of a particular queue manager it takes ownership of its queue manager directory. If you start a second instance, it can only take ownership if the first instance has stopped. If the first queue manager is still running, the second instance fails to start, and reports the queue manager is running elsewhere. If the first queue manager has stopped, then the second queue manager takes over ownership of the queue manager files and becomes the running queue manager.

You can automate the procedure of the second queue manager taking over from the first. Start the first queue manager with the strmqm -x option that permits another queue manager to take over from it. The second queue manager then waits until the queue manager files are unlocked before attempting to take over ownership of the queue manager files, and start.