Linux distributions use systemd to start up and manage services through standard command-line tools. If you installed MongoDB Enterprise or MongoDB Community through the package manager, you can manage the mongod process through the systemctl command.
Syntax
sudo systemctl <command> mongod
Commands
Command | Description |
|---|---|
| Configures systemd to start the MongoDB service during boot. |
| Restarts the MongoDB service. |
| Starts the MongoDB service. |
| Shows the status of the MongoDB service. |
| Stops the MongoDB service. |
Compatibility
On self-managed deployments, you can manage the mongod process with the systemctl command on any supported systemd-based distribution of Linux.
For details on supported platforms, see:
Behavior
User Privileges
Most commands that run through systemd require a user with elevated privileges. While the root user can administer the mongod process directly through the systemctl command, other users must run these commands with sudo privileges.
System Journal
When run through systemd with the default configuration, mongod logs messages through the system journal. The journal allows you to search for specific issues or messages with the journalctl command.
Examples
Start MongoDB
To start the MongoDB service, run the following command:
sudo systemctl start mongod
Show MongoDB Status
To show the status of the MongoDB service, run the following command:
systemctl status mongod
● mongod.service - High-performance, schema-free document-oriented database Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2026-09-21 09:41:13 UTC; 4 days ago Docs: https://docs.mongodb.org/manual Main PID: 8642 (mongod) Memory: 148.1M CPU: 2m 15s CGroup: /system.slice/mongod.service └─8642 /usr/bin/mongod --config /etc/mongod.conf
The status of the service is not privileged information. You do not need sudo to run the status command.
Stop MongoDB
To stop the MongoDB service, run the following command:
sudo systemctl stop mongod
Restart MongoDB
To restart the MongoDB service, run the following command:
sudo systemctl restart mongod
Start MongoDB on Boot
To configure the system to start the MongoDB service on startup, run the following command:
sudo systemctl enable mongod
Created symlink /etc/systemd/system/multi-user.target.wants/mongod.service → /usr/lib/systemd/system/mongod.service.
Show MongoDB Logs
To show log messages sent by MongoDB to the system journal, run the following command:
sudo journalctl -u mongod
Sep 25 18:08:45 hostname systemd[1]: Started mongod.service - High-performance, schema-free document-oriented database. Sep 25 18:08:46 hostname mongod[229981]: {"t":{"$date":"2026-09-25T18:08:46.214+00:00"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten", "msg":"MongoDB starting", "attr":{"pid":229981,"port":27017,"dbPath":"/var/lib/mongo","architecture":"64-bit","host":"hostname"}} Sep 25 18:08:46 hostname mongod[229981]: {"t":{"$date":"2026-09-25T18:08:46.214+00:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten", "msg":"Operating System", "attr":{"os":{"name":"Debian GNU/Linux 12 (bookworm)","version":"Kernel 6.1.0"}}}