Introduction:
This article summarizes the cluster replication set deployment steps for the MongoDB 3.2 release.
Requirements:• The cluster contains 2 shards (shard)• Each shard is a 1 replica set• Partitioned replica sets, configuration servers need to take into account the case of a single machine failure to ensure availability• Set the MongoDB service oplogsize for each shard below 100 in order to reduce the disk space of the experimental data and speed up the experiment• Before deployment, prepare for deployment and document the deployment architecturePre-Deployment preparation:According to the requirements, draw out the cluster deployment architecture diagram as shown in:two Linux servers with a server version of CentOS-6.6, two replica sets for highly available configurations, three slices per replica set, and three configuration servers to ensure high availability. the ports that are open are as follows: To start the configuration work:First step: Create a DirectoryStep Two: Configure three configuration servers on the 1.mongodb.com
20000 --logpath/var/lib/mongo/data/configa/configa.log--logappend--dbpath/var/lib/mongo/data/configa-- 20001 --logpath/var/lib/mongo/data/configb/configb.log--logappend--dbpath/var/lib/mongo/data/ CONFIGB--20002 --logpath/var/lib/mongo/data/configc/configc.log--logappend--dbpath/var/lib/ MONGO/DATA/CONFIGC--fork
Step Three: Configure the secondary 3 instances on 1.mongodb.com and 2.mongodb.com
To configure replica instances on 1.mongodb.com
27017 - 27018 27019
To configure replica instances on 2.mongodb.com
27017 - 27018 27019
Fourth Step: Configure route, mongos instance in 1.mongodb.com
1. mongodb.com:20000,1. mongodb.com:20001,1. mongodb.com:20002 --fork--logappend--logpath/var/lib/mongo/data/--1. mongodb.com:20000, 1. mongodb.com:20001,1. mongodb.com:2000230000
Check all of the above configurationsFifth Step: Configure the replica set
27017 Use adminrs.conf ()
config={_id: "a", Members : [{_id:0, Host: '1. mongodb.com:27017', priority:10},{_id:1, Host: '1. mongodb.com:27018', priority:1},{_id:2, Host: '1. mongodb.com:27019', priority:1},]}config={_id: "b", Members : [{_id:0, Host: '2. mongodb.com:27017', priority:10},{_id:1, Host: '2. mongodb.com:27018', priority:1},{_id:2, Host: '2. mongodb.com:27019', priority:1}, ] }
Sixth step: Shard Configuration
Sh.addshard ("A/1. mongodb.com:27017") Sh.addshard ("B/1. mongodb.com:27017 ")
MONGODB Cluster Replication Deployment