How Windows MongoDB starts as a service

Source: Internet
Author: User
Tags goto

This two weeks to do the site, I took care of the server, database and front end, contact knowledge is very much, in order to prevent later forget, hereby record.

This essay mainly records the way MongoDB starts up as a service.

1.mongodb Start-up parameters

(1) Specify the data storage path for MongoDB

Dbpath=e:\mongodb\data\

(2) Specify the log storage path for MongoDB logpath=e:\mongodb\logs\mongo.log (3) log using the Append mode Logappend=true (4) body with Journal,  Journal's role can be seen in this post: http://blog.csdn.net/t594362122/article/details/52813272 journal=true (5) The ability to turn on the Web view log Httpinterface=true Tip: These configuration information can be written into a conf configuration file, the start of the time to enter the configuration file path can be the 2.MONGODB start statement. I put the path of the Mongod executable into the environment variables of the system, it is very convenient to use. The configuration file was stored under the E disk. (1) Boot statement without authentication: Mongod--config "E:\MongoDB\etc\mongo.conf"--servicename "MongoDB" (2) Boot statement requiring authentication (followed by--auth OK): Mongod--config "E:\MongoDB\etc\mongo.conf"--servicename "MongoDB"--auth when using the above statement on demand execution. 3. Improvement-Start with batch processingIf each start to the command line to enter a lot of commands, it also seems too troublesome, so I directly to the start of the command to make a batch, the use of a direct double-click to run on it. Attached bat file: @echo Offecho **************************echo Whether authentication is turned on: Echo 1. Turn off authentication echo 2. Enable authentication echo *********************** ***
choice/c:12/m: "Please enter your choice (timeout after 5 seconds, default selection 1):"/d:1/t:5
If%errorlevel%==255 echo unexpected error! If%errorlevel%==2 goto start_and_authif%errorlevel%==1 Goto Start_no_auth

: Start_no_authecho start successfully, do not close the window mongod--config "E:\MongoDB\etc\mongo.conf"--servicename "MongoDB"
: Start_and_authecho start successfully, do not close the window mongod--config "E:\MongoDB\etc\mongo.conf"--servicename "MongoDB"--auth
echo Failed to start!

How Windows MongoDB starts as a service

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.