How to auto-restart MongoDB
Jump to navigation
Jump to search
How to auto-restart MongoDB
Prerequisites
Before starting, ensure you have:
1. Server root login credentials.
Step -1
Edit your MongoDB service
vi /lib/systemd/system/mongod.service
step -2
Add the below lines in mongod.service
under service please add the below lines Restart=always
Step -3
Then enable the monod.service
systemctl enable mongod.service
Step -4
After finishing, you need to Reload the systemctl daemon
sudo systemctl daemon-reload