How the MongoDB database installs, configures MongoDB

Source: Internet
Author: User
Tags how to install mongodb on windows install mongodb mongodb server



this blog in the most concise way to record the blogger in the process of tossing mongodb drops, including the download MongoDB, configuration environment variables, how to start Mongodbserver, how to connect Mongodbserver and how to connect mongodbserver and so on.





1. Download MongoDB


Official: Http://www.mongodb.org/downloads



This machine is a Windows 7 32-bit. So the download is mongodb-win32-i386-2.6.1.zip. Perhaps the routines are based on that version number database.


2. Configure Environment Variables


Unzip the Mongodb-win32-i386-2.6.1.zip file to E:\, and again name the mongodb-win32-i386-2.6.1 folder for MongoDB, folder structure for example with


and configure the environment variable in System setup Path = E:\mongodb\bin; ( easy to use the MOGODB command directly on the command line )

3. Configure the MongoDB database


Create a mongo.config configuration file, configure the DBPath (Database storage path) and LogPath (log file storage path) for the MongoDB database. mongo.config file contents such as the following:



You too, however, use the--dbpath option and the--logpath option to configure the path.



# #store Data heredbpath=e:\mongodb\data # #all output Go Herelogpath=e:\mongodb\log\mongo.log

 


Special tips:



Because the DBPath path is E:\mongodb\data, and this directory does not exist by default, it needs to be created manually , otherwise it will be prompted to find the directory when running startup Mongodbserver. Similarly, you need to manually create a E:\mongodb\log directory to hold the log.


4. Start MongodbserverStart mongodbserver with Mongod.exe--config E:\mongodb\mongo.config. The--config option indicates that the server is configured with information from the E:\mongodb\mongo.config configuration file at startup.

5. Connecting Mongodbserver


Use Mongo.exe to connect a MongoDB server that is already started. (Assuming the 4th step server does not start successfully, the connection Mongodbserver will be reported in the 7th Step exception Error!) )



After successful startup, enter the MongoDB shell command line and we are able to access the database on the mongodb shell command line , and we have already run CRUD operations against the database.



6. Join MongoDB to Winodows service


Window service to start the MongoDB server.



In fact, the 5th step. We're done. The installation of the MONGODB data has been configured to be able to start tinkering with MongoDB crud commands directly



, but every time through the 4th step to join the configuration and start inevitably trouble, this is the 6th step into the MongoDB to window service, implemented by starting the service to start the MongoDB service



Manager



1) Add MongoDB to Windows service so that the MongoDB service can initiate itself proactively when the system is started through the window services configuration.



After the configuration is successful. The service is visible in the services in Control Panel. For example, as seen in:



c:\users\administrator> mongod--config D:\mongodb\mongo.config--install





2) Start MongoDB Service



c:\users\administrator>net start MongoDB



3) Stop MongoDB Service



c:\users\administrator>net stop MongoDB



4) Remove the MongoDB service from the Windows service



c:\users\administrator>Mongod--remove



5) See many other configuration command options via Mongod--help.



c:\users\administrator>Mongod--help


--install Install MongoDB Service
--remove Remove MongoDB Service
7. Exception:


warning:failed to connect to 127.0.0.1:27017, reason:errno:10061



Indicates that the mondodbserver was not started or failed to start the server;


8. References:


How to Install MongoDB on Windows ( recommended )



Install MongoDB on Windows



MongoDB configuration options





9. You may be interested in:


A probe into the MongoDB database MongoDB command Getting Started



"MongoDB database" Java MongoDB CRUD Example


Reprint Please specify source: http://blog.csdn.net/andie_guo/article/details/26068711, thank you!


How the MongoDB database installs, configures MongoDB


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.