Trying to setup the sharded cluster on AWS with 2 replicasets spanning between 2 availability zones(us-west-2a and us-east-1a)
Throws the following error : ReplicaSetMonitor no master found for set while enabling sharding on a database.
Both replicasets exist and shards listing shows them, but it still throws the error.
Query router in us-west-2a complains it can't find master in rs1 which is located in us-east-1a zone.
mongos> use admin
switched to db admin
mongos> sh.enableSharding("dummy")
{
"code" : 10009,
"ok" : 0,
"errmsg" : "exception: error creating initial database config information :: caused by :: ReplicaSetMonitor no master found for set: rs2"
}
Query router in us-east-2a complains it can't find master in rs1 which is located in us-west-2a zone.
mongos> use admin
switched to db admin
mongos> sh.enableSharding("dummy")
{
"code" : 10009,
"ok" : 0,
"errmsg" : "exception: error creating initial database config information :: caused by :: ReplicaSetMonitor no master found for set: rs1"
}
Shards
{
"shards" : [
{
"_id" : "ShardA",
"host" : "rs1/ec2-52-1-46-178.compute-1.amazonaws.com:27017,ec2-54-68-104-153.us-west-2.compute.amazonaws.com:27017,ip-172-31-43-22:27017",
"tags" : [ "ORE"
]
},
{
"_id" : "ShardB",
"host" : "rs2/ec2-52-10-172-71.us-west-2.compute.amazonaws.com:27017,ec2-54-88-34-213.compute-1.amazonaws.com:27017,ip-172-31-5-130:27017",
"tags" : [
"VIR"
]
}
],
"ok" : 1
}
Replicaset -rs1
rs1:PRIMARY> rs.status()
{
"set" : "rs1",
"date" : ISODate("2015-02-26T19:50:03Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "ip-172-31-43-22:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 4943,
"optime" : Timestamp(1424970734, 1),
"optimeDate" : ISODate("2015-02-26T17:12:14Z"),
"electionTime" : Timestamp(1424975300, 1),
"electionDate" : ISODate("2015-02-26T18:28:20Z"),
"self" : true
},
{
"_id" : 1,
"name" : "ec2-54-68-104-153.us-west-2.compute.amazonaws.com:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 4932,
"optime" : Timestamp(1424970734, 1),
"optimeDate" : ISODate("2015-02-26T17:12:14Z"),
"lastHeartbeat" : ISODate("2015-02-26T19:50:01Z"),
"lastHeartbeatRecv" : ISODate("2015-02-26T19:50:02Z"),
"pingMs" : 0,
"syncingTo" : "ip-172-31-43-22:27017"
},
{
"_id" : 2,
"name" : "ec2-52-1-46-178.compute-1.amazonaws.com:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 4896,
"optime" : Timestamp(1424970734, 1),
"optimeDate" : ISODate("2015-02-26T17:12:14Z"),
"lastHeartbeat" : ISODate("2015-02-26T19:50:01Z"),
"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
"pingMs" : 66
}
],
"ok" : 1
}
Replicaset -rs2
rs2:PRIMARY> rs.status()
{
"set" : "rs2",
"date" : ISODate("2015-02-26T20:46:57Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "ip-172-31-5-130:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 8332,
"optime" : Timestamp(1424972059, 1),
"optimeDate" : ISODate("2015-02-26T17:34:19Z"),
"electionTime" : Timestamp(1424975335, 1),
"electionDate" : ISODate("2015-02-26T18:28:55Z"),
"self" : true
},
{
"_id" : 1,
"name" : "ec2-54-88-34-213.compute-1.amazonaws.com:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 8316,
"optime" : Timestamp(1424972059, 1),
"optimeDate" : ISODate("2015-02-26T17:34:19Z"),
"lastHeartbeat" : ISODate("2015-02-26T20:46:57Z"),
"lastHeartbeatRecv" : ISODate("2015-02-26T20:46:57Z"),
"pingMs" : 0,
"syncingTo" : "ip-172-31-5-130:27017"
},
{
"_id" : 2,
"name" : "ec2-52-10-172-71.us-west-2.compute.amazonaws.com:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 8275,
"optime" : Timestamp(1424972059, 1),
"optimeDate" : ISODate("2015-02-26T17:34:19Z"),
"lastHeartbeat" : ISODate("2015-02-26T20:46:56Z"),
"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
"pingMs" : 59
}
],
"ok" : 1
}
Appreciated help.
Thanks