Mongo DB Installation-and distributed cluster deployment (first draft)

Source: Internet
Author: User
Tags create mongodb

first, the installation procedure,

1. Download the latest MONGO DB database: http://www.mongodb.org/downloads?_ga=1.44426535.2020731121.1421844747\

The download is a zip.

After extracting it, place it on the F drive, or another disk, and create the following folder, Config,data,log

Config directory content: Create mongodb.conf file, content

Data directory, then create a directory db

Log directory, create a file Primary.log

2, add the F:\mongodb\bin, path to the system's environment variables.

4, another machine, again, to perform the above steps, if you still want to be on the same machine, it can be the port in the mongodb.conf for other on the line.

Second, the cluster

3, both machines use CMD to run mongod--config F:\MongoDB\Config\mongodb.conf command

4, on one of the machines, open a new cmd, run MONGO 192.1.2.230:27017/admin to go to the admin database.

5, enter Rs.status (), you can see

6, set the config variable, which is a JSON object as follows:

config={_id: ' Rs0 ', Members: [{_id:0, Host: ' 192.1.2.230:27017 '},{_id:1, Host: ' 192.1.2.198:27017 '}]}

Configure node Information

7, configuring the cluster

Rs.initiate (config)//This process may have to wait a minute or two of time.

8, Rs.status ()

Iii. How to set MONGO DB to run as a Windows service

Run command sc.exe create [MongoDB] binpath= "\" F:\MongoDB\bin\mongod.exe\ "--service--config F:\MongoDB\Config\mongodb.conf "Displayname=" mongodb-win32-x86_64-2008plus-2.6.4 "start=" Auto "

Mongo DB Installation-and distributed cluster deployment (first draft)

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.