+

Search Tips | Advanced Search

Automatic configuration of qm.ini at startup

From IBM MQ Version 9.2.0, we can configure your queue manager to automatically apply the contents of a file, or set of files, containing qm.ini overrides, on every queue manager start.

We can use this to have a configuration that can be modified and automatically replayed at the next queue manager restart. For example, if the qm.ini overrides are located on a mounted drive, it is possible to have a centralized configuration where the latest version is applied to every queue manager as they start.

We can use this functionality to simplify creating a uniform cluster, by using the automatic cluster functionality. For an example of this, see Create a new uniform cluster.Note: These overrides are only applied at queue manager start, and cannot influence the creation of the queue manager. For example, we cannot set the number of primary log files with this function.


Before starting

We can use:
  1. A single file, and create a text file containing changes to the qm.ini file.
  2. A set of qm.ini format files:

    • To identify a directory where the configurations will exist, and
    • In that directory, create files, each with the extension .ini, for example, qminisettings.ini.

The file, or files, need only contain the stanza and attribute=value settings for the items that change. For example, to update the MaxChannels attribute in the Channels stanza, the file might contain:

Channels: 
 MaxChannels=1234

Note that in qm.ini override files, any line that is prefixed with # is treated as a comment.


Enable automatic configuration of qm.ini file attributes

We can configure a new queue manager by using the -ii flag to the crtmqm command, and pointing either at a specific file, or directory. The supplied value is stored in the qm.ini file under the AutoConfig stanza, as attribute IniConfig.

We can configure an existing queue manager to enable automatic MQSC configuration, by adding the AutoConfig stanza attribute IniConfig, pointing to a valid file or directory. For example:
AutoConfig:
   IniConfig=C:\MQ_Configuration\uniclus.ini


How does automatic configuration work?

During queue manager startup, the configuration that is identified by the AutoConfig stanza attribute IniConfig is validated, to ensure valid syntax, and then stored in the queue manager data tree into the autocfg directory as a single cached.ini file.

When multiple files from a directory are processed in, they are processed in alphabetical order.

During the first ever start of the queue manager, an inability to read the file or directory prevents the queue manager from starting, with an appropriate error message both to the console and to the queue manager error log.

On subsequent restarts, if the file or directory pointed to is unreadable, the previously cached file is used and a message written to the error log of the queue manager highlights this.

When we use the strmqm command, the contents of the cached.ini file are applied to the qm.ini file as overrides before the queue manager is invoked.

This does mean that for a standby queue manager, the settings are read when the strmqm command is processed, not when the queue manager becomes active.


How does the replacement qm.ini file get built?

The very first time that automatic initialization configuration is configured and the queue manager starts, a copy of the current qm.ini file is copied into the autoconfig subdirectory inside the data directory of the queue manager as base_qm.ini. This is considered the baseline from here onwards.

On every queue manager start, that is, strmqm time, the currently active qm.ini file is discarded and replaced with a copy of the base_qm.ini. Then the configuration from the cached.ini file is applied to this file.

Once a queue manager is under automatic configuration control, all changes to the qm.ini file should be performed through the file, or files, that are pointed to using the IniConfig attribute in the AutoConfig stanza.

Because the existing qm.ini file is removed at queue manager start, only the configuration in the supplied qm.ini file using the IniConfig attribute is applied to the queue manager base line.

If a stanza or attribute was changed through automatic initialization configuration on previous starts of the queue manager, those changes are removed unless they are still identified in the file or files identified by the IniConfig attribute.

Because of the recreation of the qm.ini file at queue manager start, this means any manual changes to the qm.ini file are lost. If you really need to make a change persistent, and cannot use the IniConfig attribute to make that change, we can do either of the following:

  • Make the change to the base_qm.ini file itself.
  • Delete the base_qm.ini file.

    If you do delete this file, the base_qm.ini is re-created at the next queue manager start, based on the current contents of the qm.ini file. This hardens all the current changes as the new baseline for future starts.

Parent topic: Attributes for changing queue manager configuration information

Last updated: 2020-10-04