2016-09-17 76 views
0

我正在嘗試使用3個實例在AWS上配置MongoDB複製。 我現在有兩個實例,我可以互相ping通。 Mongo deamon以相同的複製名稱正確運行。在AWS上配置MongoDB複製

但啓動主節點後,我無法添加第二個實例枝條一個錯誤

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 
} 

有人最高審計機關的「coeection拒絕」,是因爲沒有mongod的後臺程序在第二個實例中運行,但我確認和一切都好。

的/ etc /對主實例主機

127.0.0.1 yaodao1 
54.173.155.9 yaodao2 

的/ etc /對第二個實例主機

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

您是否嘗試使用mongo shell來檢查連接b/w所有mongo? mongo --host --port – Astro

+0

@Astro我試過了,它無法連接到另一個mongod deamon。那麼問題是什麼? –

+0

@Astro我設法通過設置/etc/mongo.cfg bind_ip = 0.0.0.0來實現目標,但我不明白爲什麼。繼續尋找理由。 –

回答

0

請抽出私有IP所有節點配置的地址。