Transferred from: http://www.cnblogs.com/snake-hand/p/3172376.html
1), download MongoDB
Http://downloads.mongodb.org/win32/mongodb-win32-i386-2.4.5.zip
Download the Windows 32-bit version and unzip, the program files are in the bin directory, the other two directories are C + + calls are header files and library files. The bin directory contains the following programs:
1. Mongo.exe, command-line client tools.
2. Mongod.exe, database service program.
3. Mongodump.exe, database Backup program.
4. Mongoexport.exe, data Export tool.
5. Mongofiles.exe,gridfs tool.
6. Mongoimport.exe, data Import tool.
7. Mongorestore.exe, Database Recovery tool.
8. Mongos.exe, seemingly a performance testing tool.
2), set up MongoDB directory
Unzip it to D:\, and then rename it to MongoDB, the path is D:\mongodb
3), set the data file path
In D: Set up a Data folder, create a new DB folder in the Data folder, the path d:\data\db
4), Start MongoDB service
Go to the CMD prompt console,
D:\mongodb\bin\mongod.exe--dbpath=d:\data\db
Mon APR 16 08:50:54
Mon APR 08:50:54 warning:32-bit servers don ' t has journaling enabled by Def
Ault. Please use the--journal if you want durability.
Mon APR 16 08:50:54
Mon APR 08:50:54 [Initandlisten] MongoDB starting:pid=5084port=27017 Dbpat
H=d:\data\db 32-bit host=pc-201012302214
Mon APR 08:50:54 [Initandlisten]
Mon APR 08:50:54 [initandlisten] * * Note:when using MongoDB + bit, you is
Limited to about 2 gigabytes of data
Mon APR 08:50:54 [Initandlisten] * * See HTTP://BLOG.MONGODB.ORG/POST/13
7788967/32-bit-limitations
Mon APR 08:50:54 [initandlisten] * * with--journal, the limit is lower
Mon APR 08:50:54 [Initandlisten]
Mon APR 08:50:54 [initandlisten] db version v2.0.4, pdfile version 4.5
Mon APR 08:50:54 [Initandlisten] git version:329f3c47fe8136c03392c8f0e548506
Cb21f8ebf
Mon APR 08:50:54 [Initandlisten] Build info:windows sys.getwindowsversion (ma
Jor=6, minor=0, build=6002, platform=2, service_pack= ' Service Pack 2 ') boost_lib
_version=1_42
Mon APR 08:50:54 [Initandlisten] Options: {dbpath: "D:\data\db"}
Mon APR 08:50:54 [websvr] Admin Web console waiting for connections on port 2
8017
Mon APR 08:50:54 [Initandlisten] waiting for connections on port 27017
Default connection port for MongoDB server: 27017
After successful installation, the following interface appears in http://localhost:27017/
You is trying to access MongoDB on the native driver port. For HTTP diagnostic access, add the port number
5), randomly start MongoDB as a Windows service
Create a D:\mongodb\logs\mongodb.log file to store the MongoDB log files before installing system services:
D:\mongodb\bin\mongod--dbpath=d:\data\db--logpath=d:\mongodb\logs\mongodb.log--install
(If prompted: Error connecting to the Service Control Manager, you should run CMD with administrator
Locate the command handler C:\Windows\System32\cmd.exe right-click: Run as Administrator
)
All output going to:d:\mongodb\logs\mongodb.log Creating service MongoDB. Service creation successful. Service can is started from the command line via ' net start ' MongoDB '. D:\>net start MongoDB Mongo DB Service has started successfully.
Note: If you need to uninstall the service, execute the command: SC delete MongoDB
This step, you may see the following error:
--install have to is used with--logpath
Reference http://www.it165.net/database/html/201404/6144.html can be used as a workaround
This is a bug in version 2.6, will be fixed in the next version, then we have two options, one option is to use the previous version of 2.4.9, the other option is to first use 2.4.9 version of the installation Success service, and then upgrade to 2.6 (swollen upgrade? Replace the corresponding 2.4.9 file directly with version 2.6, and we have other options, of course, yes, the answer is yes, using the SC command to create the service, start the service with net start
1.
sc create MongoDB binPath=
"D:\MongoDB\bin\mongod.exe --service --dbpath D:\MongoDB\data --logpath=D:\MongoDB\logs\mongodb.log --logappend"
C:\WINDOWS\SYSTEM32>SC Create MongoDB binpath= "F:\mongodb\bin\mongod.exe--serv
Ice--dbpath f:\mongodb\data--logpath=f:\mongodb\log\mongo.log--logappend "
[SC] CreateService success
2.
net start MongoDB
6), Client connection verification
Open a new cmd input: D:\mongodb\bin\mongo, if prompted below, then you can start the MongoDB tour:
D:\mongodb\bin\mongo
MongoDB Shell version:2.0.4
Connecting To:test
7), view MongoDB log
View the D:\mongodb\logs\mongodb.log file to view or debug the operation of MongoDB.
Http://localhost:27017/can see the following tips:
You is trying to access MongoDB on the native driver port. For HTTP diagnostic access, add the port number
Thus, the MongoDB database service has been successfully started.
http://localhost:28017/Management
Installing MongoDB under Windows