MongoDB Installation and configuration environment (for Win7)

Source: Internet
Author: User

This article is reproduced from http://blog.csdn.net/pupingpp/article/details/39053945, if necessary, please check the original text.

The following is a brief introduction to the installation of MongoDB on the Win7, as well as possible problems.

1, download mongodb:http://www.mongodb.org/downloads on the official website;

2, installation, such as my installation Road strength: D:\Program files\mongodb2.6;

3, new MONGDB data storage road strength, such as mine: D:\ProgramData\MongoDB;

4, Start MongoDB, enter the installation road strength, find bin directory, such as my: D:\Program files\mongodb2.6\bin, a new cmd window opened, Run the Mongod.exe under the bin, note that this time to add Mongdb data files to store the--dbpath parameters, the specific operation of the command (note: If the road strength contains spaces, the road strength needs to be enclosed):

"D:\Program files\mongodb2.6\bin\mongod.exe"--dbpath "D:\ProgramData\MongoDB";

This time the service basically started up, the information is as follows:

D:\projects> "D:\Program files\mongodb2.6\bin\mongod.exe"--dbpath "D:\ProgramData\MongoDB"

2014-09-04t21:47:40.373+0800

2014-09-04t21:47:40.376+0800 warning:32-bit servers don ' t has journaling enabled by default. Please use the--journal if you want durability.

2014-09-04t21:47:40.376+0800

2014-09-04t21:47:40.394+0800 [Initandlisten] MongoDB starting:pid=6288 port=27017 Dbpath=d:\programdata\mongodb 32- Bit host=jack-pc

2014-09-04t21:47:40.394+0800 [Initandlisten]

2014-09-04t21:47:40.394+0800 [Initandlisten] * * Note:this is a A-bit MongoDB binary.

2014-09-04t21:47:40.394+0800 [Initandlisten] * * [Builds bit] is limited to less than 2GB of data (or less with--j ournal).

2014-09-04t21:47:40.394+0800 [Initandlisten] * * Note that the journaling defaults to off for the and is currently off .

2014-09-04t21:47:40.395+0800 [Initandlisten] * * See Http://dochub.mongodb.org/core/32bit

2014-09-04t21:47:40.395+0800 [Initandlisten]

2014-09-04t21:47:40.395+0800 [Initandlisten] targetminos:windows XP SP3

2014-09-04t21:47:40.395+0800 [Initandlisten] DB version v2.6.4

2014-09-04t21:47:40.396+0800 [Initandlisten] git version:3a830be0eb92d772aa855ebb711ac91d658ee910

2014-09-04t21:47:40.396+0800 [Initandlisten] Build info:windows sys.getwindowsversion (major=6, Minor=1, build=7601, platform=2, service_pack= ' Service Pack 1 ') boost_lib_version=1_49

2014-09-04t21:47:40.396+0800 [Initandlisten] Allocator:system

2014-09-04t21:47:40.397+0800 [Initandlisten] options: {storage: {dbPath: ' D:\ProgramData\MongoDB '}}

2014-09-04t21:47:40.498+0800 [Initandlisten] waiting for connections on port 27017

Note: MongoDB If you do not configure the default IP and port, the default IP is localhost, the port is 27017, and of course these parameters are configurable, not discussed here.

5, in order to observe the log information, the best start-up configuration log directory, such as my: D:\log\MongoDBLogs, so at startup, plus the--logpath parameter (specify to the specific file):

"D:\Program files\mongodb2.6\bin\mongod.exe"--dbpath "D:\ProgramData\MongoDB"--logpath "D:\log\MongoDBLogs\" MongoDB.log ";

Once started, the boot information is output to the MongoDB.log file.

6, of course, you can also put the boot information in a configuration file, start directly to read the file to get the above startup parameters, such as my: D:\Program files\mongodb2.6\mongod.cfg; mongod.cfg content is:

Logpath= D:\log\MongoDBLogs\MongoDB.log
Dbpath= D:\ProgramData\MongoDB

This command is used directly when booting: "D:\Program files\mongodb2.6\bin\mongod.exe"--config "D:\Program files\mongodb2.6\mongod.cfg";

Above the boot mode, after the system restarts to start MongoDB service, must execute the above command, "D:\Program files\mongodb2.6\bin\mongod.exe"--dbpath "D:\ProgramData\MongoDB "--logpath" D:\log\MongoDBLogs\mongodb.log "or" D:\Program Files\mongodb2.6\bin\mongod.exe "--config" D:\Program Files\mongodb2.6\mongod.cfg "; This is the trouble, it is to add MongoDB to the Windows service, the specific way to create:

Run cmd with the administrator and execute the command:

"D:\Program files\mongodb2.6\bin\mongod.exe"--config "D:\Program files\mongodb2.6\mongod.cfg"--install-- ServiceName MongoDB

This creates a service called MongoDB, and the next step is to start the service with: net start MongoDB and stop the service: net stop MongoDB;

PS: The way the creation of the official website (http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/) always fails, the service does not get up.

Note: When creating a new service using the--config method, if the contents of the Mongod.cfg file are as follows (the path is included by ""):

Logpath= "D:\log\MongoDBLogs\MongoDB.log"

Dbpath= "D:\ProgramData\MongoDB"

When you create a service, you may get an error:

2014-09-04t22:18:52.935+0800

2014-09-04t22:18:52.937+0800 warning:32-bit servers don ' t has journaling enabled by default. Please use the--journal if you want durability.

2014-09-04t22:18:52.938+0800

2014-09-04t22:18:52.938+0800 severe:failed Global Initialization:filenotopen Failed to open "" D:\log\MongoDBLogs\ MongoDB.log ""

This is because when the service is created, you will add "" to the road, so the way of the configuration does not need to use "" to include the road!

Note: The service created by the administrator just now (and only the administrator can create the service) is used by the administrator to run both commands: net start MongoDB and net stop MongoDB.

If you want ordinary users also have execute permissions, you can enter: management tools, services, find MongoDB service, start, if not, then run as Administrator: management tools and services, and then start the service, or an administrator run cmd, with net start MongoDB Startup service is also available.

MongoDB Installation and configuration environment (for Win7)

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.