Question

How do I restart mongodb?

I installed mongoldb using the one-click installer. I changed the config bind-ip and commented it out (to allow it to accept any connection). Then I wanted to restart to make the changes take effect, so I did the following:

root@mongo:~# mongo
MongoDB shell version: 3.0.0
connecting to: test
> use admin
switched to db admin
> db.shutdownServer();

Then I expected it to try and reconnect, however this happened:

2015-04-05T11:36:13.492-0400 I NETWORK  DBClientCursor::init call() failed
server should be down...
2015-04-05T11:36:13.495-0400 I NETWORK  trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2015-04-05T11:36:13.496-0400 W NETWORK  Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-04-05T11:36:13.496-0400 I NETWORK  reconnect 127.0.0.1:27017 (127.0.0.1) failed failed couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed

How can I restart my mongod process?

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
April 5, 2015
Accepted Answer

You can start MongoDB by running the following command as root:

sudo service mongod start

worked for me.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.