Sharding-02–Setup Config Servers and Shard mongod Processes

Stop mongod service

[localhost]$ sudo service mongod stop

Start Config Server 1 on Port 27018

[root]#mongod --configvr --dbpath /var/lib/cfgsvr1 --port 27018 --fork --logpath /var/lib/cfgsvr1/log --logappend --nojournal

Start Config Server 2 on Port 27019


[root]#mongod --configvr --dbpath /var/lib/cfgsvr2 --port 27019 --fork --logpath /var/lib/cfgsvr2/log --logappend –nojournal

Start Config Server 3 on Port 27020

[root]#mongod --configvr --dbpath /var/lib/cfgsvr3 --port 27020 --fork --logpath /var/lib/cfgsvr3/log --logappend –nojournal

Start Shard 1 Replica 1 on port 27011 with ReplicaSet1 as the name of Replica set


[root]# mongod --shardsvr --replSet ReplicaSet1 --dbpath /var/lib/replica11 --logpath /var/lib/replica11/log --port27011 --logappend --smallfiles --oplogSize50 --fork --nojournal



Start Shard 1 Replica 2 on port 27012 with ReplicaSet1 as the name of Replica set


[root]# mongod --shardsvr --replSet ReplicaSet1 --dbpath /var/lib/replica12 --logpath /var/lib/replica12/log --port27012 --logappend --smallfiles --oplogSize50 --fork --nojournal



Start Shard 1 Replica 3 on port 27013 with ReplicaSet1 as the name of Replica set


[root]# mongod --shardsvr --replSet ReplicaSet1 --dbpath /var/lib/replica13 --logpath /var/lib/replica13/log --port27013 --logappend --smallfiles --oplogSize50 --fork --nojournal

Start Shard 2 Replica 1 on port 27021 with ReplicaSet2 as the name of Replica set


[root]# mongod --shardsvr --replSet ReplicaSet2 --dbpath /var/lib/replica21 --logpath /var/lib/replica21/log --port27021 --logappend --smallfiles --oplogSize50 --fork –nojournal


Start Shard 2 Replica 2 on port 27022 with ReplicaSet2 as the name of Replica set


[root]# mongod --shardsvr --replSet ReplicaSet2 --dbpath /var/lib/replica22 --logpath /var/lib/replica22/log --port27022 --logappend --smallfiles --oplogSize50 --fork --nojournal



Start Shard 2 Replica 3 on port 27023 with ReplicaSet2 as the name of Replica set


[root]# mongod --shardsvr --replSet ReplicaSet2 --dbpath /var/lib/replica23 --logpath /var/lib/replica23/log --port27023 --logappend --smallfiles --oplogSize50 --fork --nojournal


Start Shard 3 Replica 1 on port 27031 with ReplicaSet3 as the name of Replica set

	--[root]#mongodshardsvr --replSet ReplicaSet3	--dbpath /var/lib/replica31 --logpath	
	/var/lib/replica31/log  port27031  logappend---- --smallfiles --oplogSize50 --fork --nojournal


Start Shard 3 Replica 2 on port 27032 with ReplicaSet3 as the name of Replica set


[root]# mongod --shardsvr --replSet ReplicaSet3 --dbpath /var/lib/replica32 --logpath /var/lib/replica32/log --port27032 --logappend --smallfiles --oplogSize50 --fork --nojournal


Start Shard 3 Replica 3 on port 27033 with ReplicaSet3 as the name of Replica set


[root]# mongod --shardsvr --replSet ReplicaSet3 --dbpath /var/lib/replica33 --logpath /var/lib/replica33/log --port27033 --logappend --smallfiles --oplogSize50 --fork --nojournal

Leave a Reply