1

I have created one replica set with the following commands

mongod --replSet s0  --dbpath E:/mongo/data/shard0/rs0 --port 37017 --shardsvr 
mongod --replSet s0  --dbpath E:/mongo/data/shard0/rs1 --port 37018 --shardsvr
mongod --replSet s0  --dbpath E:/mongo/data/shard0/rs2 --port 37019 --shardsvr 

mongo --port 37017

config = { _id: "s0", members:[
          { _id : 0, host : "localhost:37017" },
          { _id : 1, host : "localhost:37018" },
          { _id : 2, host : "localhost:37019" }]};


rs.initiate(config)

when I checked rs.status() it showing 1 primary and 2 secondaries.

Second replica set:

Now i tried to create second replica set with the following commands.

mongod --replSet s1   --dbpath E:/mongo/data/shard1/rs0 --port 47017   --shardsvr 
mongod --replSet s1  --dbpath E:/mongo/data/shard1/rs1 --port 47018   --shardsvr  
mongod --replSet s1  --dbpath E:/mongo/data/shard1/rs2 --port 47019   --shardsvr  


mongo --port 47017

config = { _id: "s1", members:[
          { _id : 0, host : "localhost:47017" },
          { _id : 1, host : "localhost:47018" },
          { _id : 2, host : "localhost:47019" }]};
rs.initiate(config)

when i checked rs.status() on second replica set its showing all are secondaries.

why there is no primary on second replica set?

Anyone help me.Thank you

nithin
  • 371
  • 9
  • 24

0 Answers0