MongoDB Background Daemon mode start

Source: Internet
Author: User

MongoDB can be started by command line and configuration file, the specific command is as follows:

Command line:

[[email protected] MongoDB] # ./bin/mongod--dbpath=/data/db

Configuration file:

[[email protected] MongoDB] # ./bin/mongod-f mongodb.conf

However, both of these methods start the MongoDB process in the foreground, and if the session window is closed, the MongoDB process also stops. But MongoDB also provides a background daemon way to start, only need to add a "--fork" parameter, it is worth noting that the "--fork" parameter must be enabled "--logpath" parameter. As shown below:

[[email protected] MongoDB] # ./bin/mongod--dbpath=data/db--fork--fork have to being used with--logpath[[email protected] MongoDB]
   
    #
    all output going to:/opt/mongodb/log/
    3300
    [[email protected] MongoDB]
    #
   

The fork parameter that the daemon mode starts can also be configured in the configuration file as follows:

port=27017dbpath=data/dblogpath=log/mongodb.loglogappend=truefork=true

Then the configuration file starts after MongoDB is also started in the background:

[[email protected] MongoDB] #  all output going to:/opt/mongodb/log/3377

Reference: http://chenzhou123520.iteye.com/blog/1634676

MongoDB Background Daemon mode start

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.