Shutdown MongoDB with auth enabled?

MongoDBDatabaseBig Data Analytics

To shutdown MongoDB, you need to use shutdownServer() as in the below syntax −

db.shutdownServer();

First you need to switch to admin as shown below −

use admin;

Here, we switched to admin −

> use admin;
switched to db admin

Following is the query to shutdown server −

> db.shutdownServer();

This will produce the following output −

server should be down...
2020-01-07T22:40:31.295+0530 I NETWORK [js] trying reconnect to 127.0.0.1:27017 failed
2020-01-07T22:40:32.326+0530 I NETWORK [js] reconnect 127.0.0.1:27017 failed failed
raja
Updated on 01-Apr-2020 14:40:23

Advertisements