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