How the MongoDB database installs and configures the MONGODB__ database

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

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 the MongoDB server, how to connect to the MongoDB server and how to connect the MongoDB server and so on.

1. Download MongoDB

Official Download Address: http://www.mongodb.org/downloads

This machine is a Windows 7 32-bit, so the download is mongodb-win32-i386-2.6.1.zip, and subsequent routines are based on that version of the database. 2. Configure Environment Variables

Unzip the Mongodb-win32-i386-2.6.1.zip file to E:\ and rename the mongodb-win32-i386-2.6.1 folder to MongoDB, directory structure as shown below and configure the environment variable in system settings 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, and the Mongo.config file contents are as follows:

You can also use the--dbpath option and the--logpath option to configure the path.

# #store Data here
dbpath=e:\mongodb\data
 
# #all output go to here
Logpath=e:\mongodb\log\mongo.log

Special Tips:

Because the DBPath path is E:\mongodb\data, and this folder does not exist by default, it needs to be created manually, or you will not be prompted to find the folder when you start the MongoDB server, or you need to manually create a E:\mongodb\log folder to save the log. 4. Start the MongoDB server using Mongod.exe--config E:\mongodb\mongo.config to start the MongoDB server. The--config option indicates that the server is configured with information from the E:\mongodb\mongo.config configuration file at startup.

5. Connect to MongoDB server

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

After successful startup, enter the MongoDB shell command line, we can access the database on the MongoDB shell command line, and we have already performed CRUD operations on the database.
6. Add MongoDB to winodows service

Window service to start the MongoDB server. In fact, to do the 5th step, we have completed the installation of MONGODB data has been configured to directly start to tinker with MongoDB crud command

, but each time through the 4th step to add configuration and start the inevitable trouble, this is the 6th step to add the MongoDB to the window service, implemented by starting the service to start the MongoDB service

Manager

1) Add MongoDB to Windows service so that the MongoDB service starts automatically when you configure the system to start through window services. After the configuration is successful, you can see the service in the services in Control Panel, as shown in the following figure:

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 more 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 MONDODB server was not started or failed to start the server; 8, reference:

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 indicate the source: http://blog.csdn.net/andie_guo/article/details/26068711, thank you.

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.