我正在尝试使用3个实例在AWS上配置MongoDB复制。 我现在有两个实例,我可以互相ping。 Mongo deamon使用相同的复制名称正确运行。
但是在启动主节点后,我无法通过错误添加第二个实例
yaodao:PRIMARY> rs.add("yaodao2:27017")
{
"ok" : 0,
"errmsg" : "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: yaodao1:27017; the following nodes did not respond affirmatively: yaodao2:27017 failed with Connection refused",
"code" : 74
}
有人认为"系统被拒绝"是因为没有mongod deamon在第二次运行,但我验证了一切都没问题。
主要实例的/ etc / hosts
127.0.0.1 yaodao1
54.173.155.9 yaodao2
/ etc / hosts for second instance
127.0.0.1 yaodao2
54.175.238.78 yaodao1
主要
的rs.status()yaodao:PRIMARY> rs.status()
{
"set" : "yaodao",
"date" : ISODate("2016-09-17T13:34:01.032Z"),
"myState" : 1,
"term" : NumberLong(4),
"heartbeatIntervalMillis" : NumberLong(2000),
"members" : [
{
"_id" : 1,
"name" : "yaodao1:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 1132,
"optime" : {
"ts" : Timestamp(1474118471, 2),
"t" : NumberLong(4)
},
"optimeDate" : ISODate("2016-09-17T13:21:11Z"),
"electionTime" : Timestamp(1474118471, 1),
"electionDate" : ISODate("2016-09-17T13:21:11Z"),
"configVersion" : 59679,
"self" : true
}
],
"ok" : 1
}
答案 0 :(得分:0)
请为所有节点配置获取专用IP地址。