Can I restart mongodb server through mongo shell?

684    Asked by BellaBlake in Python , Asked on Jul 14, 2021

With the help of mongo CLI client, can I restart a MongoDB server?

Answered by Carl Paige

What you can do is you can restart mongodb server by executing the following syntax as root:

>sudo service mongod start
Or just shut down your server via the client. And then start it.
>mongo --host "hostname where server or IP" --port "port of mondodb server" --username "username" --password "password"
>use admin
>db.shutdownServer()

Your Answer

Interviews

Parent Categories