[SERVER-17401] ReplicaSetMonitor no master found for set Created: 26/Feb/15  Updated: 27/Feb/15  Resolved: 27/Feb/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.6.8
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: gruprc Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

Create 2 replica sets spanning different availabilty zone
add the shards through query router
try to enable the sharding on database.
Error throws instead of enabling the sharding on database.

Participants:

 Description   

Trying to setup the sharded cluster on AWS with 2 replicasets spanning between 2 availability zones(us-west-2a and us-east-1a)
Throws "ReplicaSetMonitor no master found for set" error 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 rs2 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



 Comments   
Comment by Ramon Fernandez Marina [ 27/Feb/15 ]

No problem – thanks for the update. Enjoy your new MongoDB cluster!

Comment by gruprc [ 27/Feb/15 ]

Thanks Ramon.
You can close the issue.
Seems like by default replicaset primary is assigning to internal ip address.
So i've re-configured using the following, and then it started working
cfg = rs.conf()
cfg.members[0].host = "primaryhostip:port"
rs.reconfig(cfg)

Comment by Ramon Fernandez Marina [ 27/Feb/15 ]

guru, the information you sent makes me think that your primaries are in private networks (172.31.x.x), so your mongos may not be able to reach them. If this is the case you either need to prevent those members of your replica sets from becoming primaries, or give them real addresses and reconfigure your replica sets.

That being said, please note that the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag, where your question will reach a larger audience. A question like this involving more discussion would be best posted on the mongodb-user group.

Regards,
Ramón.

Generated at Thu Feb 08 03:44:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.