MongoDB Learning Note One: Configuring

Source: Internet
Author: User
Tags create directory create mongodb

Download MongoDB

: https://www.mongodb.com/download-center?jmp=nav#community

Here is the installation of MongoDB under the Windows platform,

After downloading, on this computer, follow the prompts to install.

Note: This installation is only to get MongoDB files, the installed machine is not a server.

For example, this machine is installed in D:\MongoDB\Server\3.2

Configure server 1. Create a Directory

Create directory C:\MongoDB on the server (Windows Server 2008), such as:

Consists of four directories

BIN MongoDB Program Files
Config Configuration file
Data Data Files Directory
Log Log file
2. Copying files

Copy all the files in the D:\MongoDB\Server\3.2\BIN directory that you have installed in the first step to the server C:\MongoDB\BIN directory.

In addition, the Msvcp120.dll and Msvcr120.dll files are found in this machine, and also copied to the bin directory of the server.

3. Configuration files

In the config directory, create the Mongod.cfg file. The contents are as follows:

Dbpath=c:\mongodb\data

Logpath=c:\mongodb\log\mongo.log

Logappend=true

Directoryperdb=true

#auth =true

Start MongoDB Service

In the server's C:\MongoDB\Bin directory, run cmd as Administrator, and execute the following command

SC create MongoDB binpath= "C:\MongoDB\bin\mongod.exe--config=c:\mongodb\config\mongod.cfg--service"

Then start the service net start MongoDB

Test

In the C:\MongoDB\Bin directory, run cmd, and execute the following command
C:\mongodb\bin>mongo

Show DBS//Display Database
Use MyDB//create and switch databases
Db. Projects.insert ({"Name": "Project"})//In the Projects collection, insert a record
Help//Assistance

Connection test

On the client, run Mongovue and connect to the server.

Test Connection succeeded!

Uninstalling the MongoDB service

On the server side, run cmd as Administrator and execute the following command:

C:\MongoDB\bin mongod.exe--remove--servicename "MongoDB"

MongoDB Learning Note One: Configuring

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.