Installing MongoDB under Win7 environment

Source: Internet
Author: User
Tags download mongodb for windows mongodb client

1. Get from http://www.mongodb.org/downloads, download MongoDB for Windows version, note the difference between 32-bit and 64-bit
2. Unzip the downloaded zip version to D:/mongodb
3. Create a storage location for the database files. The default location of the system is c:/data/db, which allows you to modify the folder path at startup by using parameter--dbpath. such as d:/mongodb/data/db.
Note that this folder needs to be created manually and MongoDB does not start properly if the folder does not exist.
4. Open the cmd command line and start the MongoDB service.
D:/mongodb/bin/mongod.exe--dbpath d:/mongodb/data/db
Show:
D:\>mongodb\bin\mongod.exe--dbpath D:\mongodb\data\db
2014-08-18t11:58:48.034+0800 [Initandlisten] MongoDB starting:pid=6964 port=27017 dbpath=d:\mongodb\data\db 64-bit Host=dell-pc
2014-08-18t11:58:48.052+0800 [Initandlisten] targetminos:windows 7/windows Server R2
2014-08-18t11:58:48.070+0800 [Initandlisten] DB version v2.6.4
2014-08-18t11:58:48.080+0800 [Initandlisten] git version:3a830be0eb92d772aa855ebb711ac91d658ee910
2014-08-18t11:58:48.097+0800 [Initandlisten] Build info:windows Sys.getwindowsv
Ersion (major=6, Minor=1, build=7601, platform=2, service_pack= ' Service Pack 1 ') boost_lib_version=1_49
2014-08-18t11:58:48.123+0800 [Initandlisten] Allocator:system
2014-08-18t11:58:48.132+0800 [Initandlisten] options: {storage: {dbPath: ' D:\mongodb\data\db '}}
2014-08-18t11:58:48.182+0800 [Initandlisten] Journal Dir=d:\mongodb\data\db\journal
2014-08-18t11:58:48.224+0800 [Initandlisten] recover:no journal files present, no recovery needed
2014-08-18t11:58:48.267+0800 [Initandlisten] waiting for connections on port 27017


Is the normal start, listening to 27017 port, can be accessed through http://localhost:27017/, you can see some relevant information


The database port can be modified by--port, such as: D:\>mongodb\bin\mongod.exe--port 88888--dbpath D:\mongodb\data\db


5. Then open a CMD window and enter D:/mongodb/bin/mogod.exe to create a MONGODB client
MongoDB Shell version:2.6.4
Connecting To:test


6, the connection is successful, to conduct the first Test


View the currently connected database
>db
Test


Create a table and insert a row of data
>db.test_table.insert ({a:1})


View the data you just inserted
>db.test_table.find ()


7, like step 4 to start MongoDB service is very troublesome, you can register MongoDB as a MySQL service, so it is more convenient.
Enter under cmd: D:\mongodb\bin\mongod.exe--logpath D:\mongodb\logs\mongodb.log--logappend--dbpath D:\mongodb\data\db-- Directoryperdb--servicename MongoDB--install
To create a system service
--logpath: Specifies the directory for the log
--logappend: Indicates that the log was added in an additional way
--dbpath: Specifies the storage directory for the data
--directoryperdb: Explains that each database creates a new directory
Mongodb:windows Service Name
--install means install (instead,--remove means delete)


8. You can manage services through net start MongoDB, net stop MongoDB, or through the service interface.

Installing MongoDB under Win7 environment

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.