MongoDB Database Installation Configuration __ Database

Source: Internet
Author: User
Tags mongodb

Recently there is a need to deal with a large number of unstructured data , the original use of the MySQL database has gradually a little satisfied with the need, by comparing the various databases (MySQL, Redis, MongoDB, hbase, etc.) after the pros and cons (there are classic article reference: http:/ /blog.csdn.net/defonds/article/details/48471087), consider trying to use the MongoDB database for processing. This paper mainly introduces the installation and simple test of MongoDB database. 1.MongoDB Installation

First, we download the installation package from MongoDB official website (https://www.mongodb.com/download-center#community), After downloading the installation package will be placed in the installation directory you want directly double-click the installation can be (I am under the installation version of the. msi suffix), the local directory is: D:\software\mongodb, after the installation is completed MongoDB directory new \data\db and \data\log directory, used to install db and log files , respectively. 2.MongoDB Test 2.1 Test MongoDB is installed successfully

In the command window, switch to the D:\software\mongodb\bin directory and execute the mongod-dbpath "d:\mongodb\data\db" command. As shown in the following illustration:


As you can see from Figure 2, theMongoDB database is turned on and waiting for the service to connect to the 27017(mongodb default port) port.
At this point, a new command window opens, the same switch to the D:\software\mongodb\bin directory, enter the MONGO command, you can connect to the MongoDB database. As shown in the following illustration:

At the same time, the server side received a connection and accepted it, as shown in the following illustration:

So far, the MongoDB database has been installed successfully . However, the MongoDB default needs to first open Mongod.exe(server-side program),mongo.exe(client program) to connect to the database, more trouble, Next, you will need to open mongod.exe in advance by installing MongoDB as a Windows service to avoid each time you use the database. 2.2 Installing MongoDB as a Windows service

(1) Open the Command window, switch to the D:\software\mongodb\bin directory, and execute the following command:

Mongod--dbpath "d:\mongodb\data\db"--logpath "D:\mongodb\data\log\MongoDB.log"--install "--servicename"

Where MongoDB.log is the log file that was started, the"MongoDB" service name is MongoDB.
As shown in the following illustration:

(2) Start mongdb service

The Execute net start MongoDB command starts the MongoDB service . As shown in the following illustration:

At this point, you can see that the mongo.exe and mongod.exe processes are already open in Task Manager.

If a 100 error occurs during the start of the MongoDB service, it may be that the previously opened Mongod.exe process is not closed. Turn off the process and delete the mongod.lock file (if any) in the DB directory, and repeat the process.

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.