How to restart mongodb in linux?

by herminia_bruen , in category: PHP Databases , 9 months ago

How to restart mongodb in linux?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by adan , 3 months ago

@herminia_bruen 

To restart MongoDB on a Linux machine, follow these steps:

  1. Open a terminal window and connect to the machine where MongoDB is installed.
  2. To stop MongoDB, type the following command:
1
sudo service mongod stop


  1. To start MongoDB again, type the following command:
1
sudo service mongod start


  1. To check the status of MongoDB, type the following command:
1
sudo service mongod status


This will show you whether MongoDB is currently running or not.


Alternatively, you can use the following command to restart MongoDB:

1
sudo service mongod restart


This will stop and start MongoDB in one command.