Release 2.4.0

Changes to the DMK in 2.4.0

Here are the main changes introduced by DMK 2.4.0.

Changes made to dmk_status.py script

The table view now supports sorting by any column. Use the -o option followed by the column name to specify the sorting column, for instance -o='port' to sort by port number. Sorting is ascending by default, but you can add a negative sign - before the column name for descending order, for instance -o='-port'. You can also specify multiple columns for sorting, for instance -o='version,state' to sort first by version and then by state.

mongodb@dmkmongo:/home/mongodb/ [mdb01] sta -o="-version"

Instance             | State                | Version | Port  | Bind IPs
-------------------------------------------------------------------------------
mdb01                | STARTED              | 8.0.16  | 27017 | 0.0.0.0
mdb02                | STARTED              | 8.0.16  | 27016 | 0.0.0.0
mdbrs01              | STARTED              | 8.0.15  | 27101 | 0.0.0.0

The session view now supports filtering. You can filter with multiple criteria, and combine them as needed. Here are the available filters:

  • Minimum runtime (--min-runtime <seconds>)

  • Client IP (--client <ip_address>)

  • User filtering (--user <username>)

  • Application name (--app <application_name>)

  • Database and collection (--ns <namespace>)

You can also add the --show-query option to display the query for each session, which can be very useful in combination with the filters to quickly identify problematic queries. For instance, --min-runtime 10 --show-query will show all sessions that have been running for more than 10 seconds along with their queries.

Example with the --app option:

When viewing the status of a single instance with lsta (or dmk_status.py -l), the list of databases is now displayed.

New replicat set features

  • The rsta alias display was improved to show more information.

  • A stepdown alias was added to allow stepping down the primary directly from the DMK command line. Its definition is rather simple: alias stepdown='msp --eval "rs.stepDown()"'.

Improvements to the set_local_dmk_config.py script

The set_local_dmk_config.py script now supports setting the local DMK configuration for custom instances, by adding categories. its usage doesn't change, and is described in the Environment variables page.

Better support for instances managed with systemd

DMK better supports MongoDB instances that are managed with systemd. The dmk_db_ctl.py script will automatically detect if an instance is managed with systemd and use systemctl commands to start, stop or restart the instance. This allows for better integration with the operating system and can provide more reliable management of MongoDB instances.

  • Two new aliases were added to access systemd unit files of instances: cdsys to access the folder containing the unit file, and visys to view the content of the unit file.

  • A MONGO_SERVICE_NAME variable was added to the configuration, which allows to specify the name of the systemd service for each instance. This is useful when the service name doesn't follow a standard pattern based on the instance name. By default, MONGO_SERVICE_NAME is set to mongod_${MONGO_INSTANCE}.service, but you can overwrite it in your local configuration file if needed.

New aliases and environment variables

Some new aliases were added in this release. New aliases:

  • cdp: alias to access the $MONGO_BASE/product folder.

  • cdbin: alias to access the MongoDB binaries folder of an instance.

  • dmkjs: alias to access the DMK JavaScript folder. It is also available as a variable (dmkjs=$DMK_HOME/js).

  • cdsys: alias to access the systemd unit files folder.

  • visys: alias to view the systemd unit file of an instance.

  • stepdown: alias to step down a primary instance with the rs.stepDown() command.

  • mgstatus: alias to show the status of all instances with the dmk_status.py --list command. It has the same output as the lsta alias, but it was added to work with the other mgstop, mgstart and mgrestart aliases.

New environment variables:

  • MONGO_SERVICE_NAME environment variable to specify the name of the systemd service for each instance. By default, it is set to mongod_${MONGO_INSTANCE}.service, but you can overwrite it in your local configuration file if needed.

  • MONGO_CRED variable to specify the path to the credential file of an instance. It is set by default to ${MONGO_BASE}/admin/${MONGO_INSTANCE}/secret/cred.yaml, but you can overwrite it in your local configuration file if needed. This variable is used in the msp alias to automatically provide credentials when connecting to an instance with mongosh. More specifically, you can now set MONGO_CRED in the [INSTANCE] group in your local configuration file to have the msp alias automatically use the same credentials for all instances, which is very useful when managing multiple instances with the same credentials.

Last updated