How the MongoDB database installs, configures MongoDB

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



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, maybe the routine is based on this 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, andmongo.config file contents such as the following:



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


##store data here
dbpath=E:\mongodb\data
 
##all output go here
logpath=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.






watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvyw5kawvfz3vv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
5. Connecting Mongodbserver



Use Mongo.exe to connect a MongoDB server that is already started. (Assuming that 4th step server did not start successfully.) Connecting Mongodbserver will report the error in the 7th step exception! )



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.






watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvyw5kawvfz3vv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
6. Join MongoDB to Winodows service



Window service to start the MongoDB server. In fact, the 5th step, we're done. The installation of MONGODB data has been configured to directly start tinkering with MongoDB crud commands



, but each time through the 4th step to join the configuration and start inevitably trouble. This is the 6th step to join the MongoDB to window service. Enables the start of the MongoDB service by starting the 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, you can see the service 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.


MongoDB Database How to install, configure 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.