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.
- 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. We 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
- From v7.0.1, there are two alternative ways to specify the location of queue manager data.
- Use 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 we 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
- Use 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 we change the location of the queue manager data directory for any queue manager we 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. Before V7.0.1, a queue manager was only used on one system. One set of subdirectories was sufficient to define the directory path to IPC file system objects, see Figure 2.
In V7.0.1, and later, 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 3.
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:
- The first 20 characters are not unique.
- 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 4.
- 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.
Up until v7.0.1, IBM MQ relied upon external management to guarantee queue managers exclusive access to the queue manager data and log files. From v7.0.1 onwards, 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.
We 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.
Parent topic: Plan file system support on Multiplatforms