Mongodb exception: connect failed
sudo service mongo stop [This didn't work]


As MongoDB BOL  mongo is an interactive JavaScript shell interface to MongoDB, which provides a powerful interface for systems administrators as well as a way for developers to test queries and operations directly with the database. mongo also provides a fully functional JavaScript environment for use with a MongoDB.

And mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.

As simple language we can say that mongo is shell interface for MongoDB. And mongod is server , which handles data requests, manages data access, and performs background management operations.

So, in place sudo service mongo stop it should be the below mention command


  sudo service mongod stop


As MongoDB documented Here Some of basic procedure to check MongoDB services in RHEL is as mention below:

Start MongoDB

sudo service mongod start


Stop MongoDB

sudo service mongod stop


Restart MongoDB

sudo service mongod restart


Verify that MongoDB has started successfully

sudo chkconfig mongod on


Begin using MongoDB

Start a mongo shell on the same host machine as the mongod

mongo --host 127.0.0.1:27017