This article represents different commands which can be used to check the status of MongoDB database on Linux/Ubuntu. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos.
Note that mongod represents the daemon process of MongDB databass and, primarily, used to manage database access. Following are some of the commands which can be used to get the status of Mongodb:
- service mongod status: Displays the status of MongodB service as like the screenshot given below.
- systemctl status mongod: Displays the same status of MongoDB service as like above command as shown in figure 1.
- pgrep mongo: Prints the process ID of running mongo instance. pgrep command looks through the list of running processes and list down the process ids based on name.
- ps -e | grep mongo: Prints the process detail of running mongo instance
- nc -v localhost 27017: Prints whether connection to mongodb running on port 27017 is succeeded.