MongoDB日常运维-06副本集搭建错误汇总

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",共同学习,共同成长!!!    

请使用浏览器的分享功能分享到微信等