1) download MongoDB
Http://downloads.mongodb.org/win32/mongodb-win32-i386-2.4.5.zip
Download and decompress windows 32-bit. The program files are in the bin directory. The other two directories are the header files and library files called by C ++. The bin directory contains the following programs:
1. cmd.exe, a command line Client tool.
2. mongod.exe, a database service program.
3. mongodump.exe, a database backup program.
4. Export export.exe, a data export tool.
5. Unzip files.exe, gridfs tool.
6. mongoimport.exe, a data import tool.
7. mongorestore.exe, a database restoration tool.
8. ipvs.exe, which seems to be a performance testing tool.
2) set the MongoDB directory
Decompress it to D: \ and rename it to MongoDB. The path is D: \ MongoDB.
3) set the data file path
Create a data folder in D: disk and create a new DB folder in the data folder. Path: D: \ data \ DB
4) Start the MongoDB Service
Enter the CMD prompt console,
D: \ MongoDB \ bin \ mongod.exe -- dbpath = D: \ data \ DB
Mon Apr 16 08:50:54
Mon Apr 16 08:50:54 warning: 32-bit servers don't have journaling enabled by def
ault. Please use --journal if you want durability.
Mon Apr 16 08:50:54
Mon Apr 16 08:50:54 [initandlisten] MongoDB starting : pid=5084port=27017 dbpat
h=d:\data\db 32-bit host=PC-201012302214
Mon Apr 16 08:50:54 [initandlisten]
Mon Apr 16 08:50:54 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are
limited to about 2 gigabytes of data
Mon Apr 16 08:50:54 [initandlisten] ** see http://blog.mongodb.org/post/13
7788967/32-bit-limitations
Mon Apr 16 08:50:54 [initandlisten] ** with --journal, the limit is lower
Mon Apr 16 08:50:54 [initandlisten]
Mon Apr 16 08:50:54 [initandlisten] db version v2.0.4, pdfile version 4.5
Mon Apr 16 08:50:54 [initandlisten] git version: 329f3c47fe8136c03392c8f0e548506
cb21f8ebf
Mon Apr 16 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 16 08:50:54 [initandlisten] options: { dbpath: "d:\data\db" }
Mon Apr 16 08:50:54 [websvr] admin web console waiting for connections on port 2
8017
Mon Apr 16 08:50:54 [initandlisten] waiting for connections on port 27017
Default connection port of the MongoDB server: 27017
5) Use MongoDB as a Windows Service for random startup
Create the D: \ MongoDB \ logs \ MongoDB. Log File to store the MongoDB log file, and then install the system service:
D: \ MongoDB \ bin \ mongod -- dbpath = D: \ data \ dB -- logpath = D: \ MongoDB \ logs \ MongoDB. Log
-- Install
(If the error message "error connecting to the Service Control Manager" is displayed, run cmd as an administrator.
Right-click the command handler c: \ windows \ system32 \ cmd.exe and run it as an administrator.
)
All output going to: D: \ MongoDB \ logs \ MongoDB. log creating service MongoDB. service creation successful. service can be started from the command line via 'net start "MongoDB "'. d: \> Net start MongoDB Mongo dB service has been started successfully. D:>
Note: To uninstall the service, run the command SC Delete MongoDB.
6) Client Connection Verification
Open a new cmd input: D: \ MongoDB \ bin \ Mongo. If the following prompt appears, you can start your MongoDB Journey:
d:\mongodb\bin\mongo
MongoDB shell version: 2.0.4
connecting to: test
7) view MongoDB logs
View the D: \ MongoDB \ logs \ MongoDB. Log File to view the running status of MongoDB or troubleshoot it.
Http: // localhost: 27017/you can see the following prompt:
You are trying to access MongoDB on the native driver port. For HTTP diagnostic access, add 1000 to the port number
In this way, the MongoDB Database Service has been successfully started.
Http: // localhost: 28017/manage