MongoDB日常運維-06副本集搭建錯誤彙總

chenoracle發表於2020-03-22

MongoDB日常運維-06副本集搭建錯誤彙總

一:MongoDB常用命令彙總

二:MongoDB安裝

三:MongoDB主從複製搭建

四:MongoDB副本集搭建 

五:MongoDB副本集故障切換

六:MongoDB副本集搭建錯誤彙總


六:MongoDB副本集搭建錯誤彙總

錯誤一:

叢集初始化時,報錯:

replSetInitiate quorum check failed because not all proposed set members responded affirmatively

: 192.168.2.187:27017 failed with Error connecting to 192.168.2.187:27017 :: 

caused by :: Connection refused, 192.168.2.188:27017 failed with Error 

connecting to 192.168.2.188:27017 :: caused by :: Connection refused"

如下:

> rs.initiate(config)

{

"ok" : 0,

"errmsg" : "replSetInitiate quorum check failed because not all proposed set members responded affirmatively: 192.168.2.187:27017 failed with Error connecting to 192.168.2.187:27017 :: caused by :: Connection refused, 192.168.2.188:27017 failed with Error connecting to 192.168.2.188:27017 :: caused by :: Connection refused",

"code" : 74,

"codeName" : "NodeNotFound"

}

問題原因:

主從庫配置檔案裡沒有配置 bind_ip引數,預設只能遠端連線資料庫

可以在從節點遠端連線主庫進行測試

mongo --host 192.168.2.222 --port 27017

也會出現Connection refused錯誤

解決方案:

主從庫配置檔案mongodb.conf新增bind_ip引數,重啟資料庫。

bind_ip = 0.0.0.0

歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!    

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-2681970/,如需轉載,請註明出處,否則將追究法律責任。

相關文章