xxxxxxxxxx
sudo systemctl start mongod
sudo systemctl stop mongod
xxxxxxxxxx
sudo mongod
# or
sudo mongod --fork --logpath /var/log/mongod.log # start in background
# or
sudo mkdir -p /data/db
sudo mongod --port 27017 --dbpath /data/db --fork --logpath /var/log/mongod.log
xxxxxxxxxx
# Start MongoDB.
sudo systemctl start mongod
# Verify that MongoDB has started successfully.
sudo systemctl status mongod
# Stop MongoDB.
As needed, you can stop the mongod process by issuing the following command:
sudo systemctl stop mongod
# Restart MongoDB.
sudo systemctl restart mongod