MongoDB Background Run

Source: Internet
Author: User

By default, shutting down the Shell,mongodb stops running.

If you want to run in the background, just add the--fork function when you start.

You can add--logappend after the log path to prevent the log from being deleted.

Bin/mongodb--fork--dbpath=//--logpath=//--logappend

Run in the background, if you want to close it, you need to send Shutdownserver ()

1. General Command: $ ./mongod> use admin> db.shutdownserver ()
Note that this command is only allowed locally, or a certified client.
2, if this is a master-slave replication cluster, after the 1.9.1 version will be followed by the following steps to close
  • Check for data update time from MongoDB
  • If all the time difference from MongoDB and master is more than 10, this will not close MongoDB (in this case, we can configure the Timeoutsecs way to let the data from MongoDB to complete the update)
  • If there is a time difference from MongoDB to the primary service within 10 seconds, then the master server will shut down and wait for the update from MongoDB to complete and close.
3. If there is no up-to-date from MongoDB and you want to force shutdown service, you can add force:true by adding the command as follows:> Db.admincommand ({shutdown:1, force:true}) >//or > Db.shutdownserver ({force:true})
4, specify a specific time-out to shut down the server, the command above, plus a timeoutsec: Parameters > Db.admincommand (shutdown:1, Force:true, timeoutsec:5) >//or> db . Shutdownserver ({force:true, timeoutsec:5})

MongoDB Background Run

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.