MongoDB cluster configuration

Source: Internet
Author: User

This article demonstrates: (one primary server, one backup server, three quorum servers)

The official recommended replica set has an odd number of members, up to 12 replica set nodes, and a maximum of 7 nodes to participate in the election.

This article demonstrates the use of port-differentiated services based on this machine (the new DB folder under each server is used to store data,mongodb.conf file configuration startup parameters)

The contents of each server configuration file are as follows:

27000 Primary Server

Dbpath=d:\mongodb\server27000\3.2\db

port=27000

replset=datamip/127.0.0.1:27001

There are additional servers under the replica set 27001

27001 backing up the server

Dbpath=d:\mongodb\server27001\3.2\db

port=27001

replset=datamip/127.0.0.1:27000

Primary server

27002 Quorum Server

Dbpath=d:\mongodb\server27002\3.2\db

port=27002

replset=datamip/127.0.0.1:27001

Primary server

27003 Quorum Server

Dbpath=d:\mongodb\server27003\3.2\db

port=27003

replset=datamip/127.0.0.1:27001

Primary server

27004 Quorum Server

Dbpath=d:\mongodb\server27004\3.2\db

port=27004

replset=datamip/127.0.0.1:27001

Primary server

27000 Primary server 27001 Backup server 27002 quorum server 27003 quorum server 27004 Arbiter Server Create service sc.exe create mongodb27000 binpath=  " C:\mongodb\server27000\bin\mongod.exe --service --config=\ "C:\MongoDB\Server27000\mongodb.conf" "  DisplayName=  "MongoDB27000"  start=  "Auto" sc.exe create mongodb27001  binpath=  "C:\mongodb\server27001\bin\mongod.exe --service --config=\" C:\MongoDB\Server27001\ Mongodb.conf ""  DisplayName=  "MongoDB27001"  start=  "Auto" sc.exe create  mongodb27002 binpath=  "c:\mongodb\server27002\bin\mongod.exe --service --config=\" c \ Mongodb\server27002\mongodb.conf ""  DisplayName=  "MongoDB27002"  start=  "Auto" sc.exe  create mongodb27003 binpath=  "c:\mongodb\server27003\bin\mongod.exe --service -- Config=\ "C:\MongoDB\Server27003\mongodb.conf" " DisplayName= " MongoDB27003 " start= " Auto " Sc.exe create mongodb27004 binpath=  "C:\mongodb\server27004\bin\mongod.exe --service --config=\" C:\MongoDB\Server27004\ Mongodb.conf ""  DisplayName=  "MongoDB27004"  start=  "Auto" start the service >mongo 192.168.200.111:27000 /admin//connection Primary>db.runcommand ({"replsetinitiate": {"_id": "Datamip", "members": [{"_id": 1, "host": " 192.168.200.111:27000 "},{" _id ": 2," "Host": "192.168.200.111:27001"}]})   Wait a few moments while waiting for 27000 to become primary add the following configuration > MONGO 192.168.200.111:27000/admin>rs.addarb ("192.168.200.111:27002") >rs.addarb ("192.168.200.11127003") >rs.addarb ("192.168.200.111:27004")

MongoDB Cluster configuration

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.