I used MongoDB recently and it was easy to set it up and run it in accordance with development box (compiled development package, double-click installation), but I would like to refer to the documentation for Setup (using Zip package)
Installing MongoDB
Download MongoDB from the official website, download the different versions according to your own needs, I downloaded the 64-bit zip file. The. msi file is installed in the Program Files directory (default), But I prefer to put the installation files (Zip packages) and database files (created after database creation) together so that you don't have to run with admin
Remove the zip file and place it in C:\MongoDB
Enter C:\MongoDB, create a Data subdirectory, enter and create the DB subfolder and the Log subfolder, the bin folder already exists, and finally
Your folder structure is as follows,
C:\mongodb \ \data \db \log
Configure MongoDB
Add a file c:\MongoDB\mongod.cfg contains the following content
systemlog: destination:file path:c:\mongodb\data\log\mongodb.log trueStorage : dbpath:c:\mongodb\data\dbnet: 127.0. 0.1 27017
The path to log and DB and the port number are the default, and it's easy to change. Note that IP is only bound to 127.0.0.1, because that is not safe, so I do not want to be exposed on the network, more configuration options see the documentation.
Test MongoDB
Run the following command
C:\mongodb\bin>mongod.exe-f. \mongod.cfg
Then in another command Window (WIN+R), run the service to make sure that he can run successfully.
The following error occurred when I connecting, so I closed the service
D:\mongodb\bin>mongo MongoDB Shell version:2.6.1connecting to:test> use adminswitched to DB admin> db.shutdownserver ()2014-06-10t1 4:28:35.567-0400 Dbclientcursor::init Call () Failedserver should is down ... 2014-06-10t14:28:35.571-0400 trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed2014-06-10t14:28:36.579-0400 warning:failed to connect to 127.0.0.1:27017, reason:errno:10061 No connection could being made because the target machine Actively refused it.2014-06-10t14:28:36.579-0400 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> Exitbye
Install it as a service
We now know that our configuration is correct, so I want to install a service so that he always runs
Start a Administrator command prompt (with administrator privileges)
Win7:win+r into CMD, then press and hold Ctrl+shift+enter
Press A after win8:win+x
Run command now
Sc.exe Create MongoDB binpath= "C:\MongoDB\bin\mongod.exe--service--config=c:\mongodb\mongod.cfg" Displayname= " MongoDB 2.6 Standard "start=" Auto "
You should see
[SC] CreateService SUCCESS
Now you can turn the service on and off according to the following command (if you can't start, manually turn on service task Manager-Services)
net start mongodbnet stop MongoDB
If you want to uninstall the service
Sc.exe Delete MongoDB
Original Connection http://www.alteridem.net/2014/06/10/running-mongodb-on-windows/
Running MongoDB on Windows