Starting & Stopping MongoDB instances

Basic instance management with MongoDB

This page describes three ways to manage MongoDB instances using DMK.


Managing MongoDB instances with dmk_db_ctl.py

You can manage MongoDB instances using the control script provided by DMK:

$DMK_HOME/bin/dmk_db_ctl.py -i <instance_name> -a [start|stop|restart]

Replace <instance_name> with the actual name of your instance (e.g., mdb01).


Managing MongoDB instances with aliases (mgstart, mgstop, mgrestart)

If you have sourced your DMK environment, you can use the following aliases:

# Start the current instance
mgstart

# Stop the current instance
mgstop

# Restart the current instance
mgrestart

These aliases are just shortcuts to the dmk_db_ctl.py script.


Managing MongoDB instances with systemd

If your instance is configured with a systemd service, you can manage it using:

sudo systemctl [start|stop|restart|status] mongod_<instance_name>.service

Make sure the service name matches the instance name (e.g., mongod_mdb01.service).

Last updated