首页 文章

尝试复制mongodb时出现通信错误

提问于
浏览
1

我正在尝试复制我的mongodb数据库,我在我的windows azure帐户上创建了2个VM . 它们都是Ubuntu 14.04 . 我在两个端口上都打开了27017端口,并安装了mongodb最新版本 . 我开始使用mongo

mongod --port 27017 --dbpath /data/datadrive --replSet rs0

在两台机器上,并使用添加其他成员

rs.add(“内部IP地址:27017”)

我一直得到一个错误,我有两个初选,因为/etc/mongodb.conf中的bind_ip配置,我正在其中一个论坛中阅读,因此我将bind_ip更改为两个VM上的其他Vm私有网络IP尝试添加服务器成员我有以下错误 .

在“主要”方面:

[rsMgr] not electing self, 100.79.138.73:27017 would veto with 'I don't think reptester1:27017 is electable'
[rsHealthPoll] replset info 100.79.138.73:27017 thinks that we are down
[rsHealthPoll] replset info 100.79.138.73:27017 thinks that we are down

在“次要”方面:

[rsHealthPoll] getaddrinfo("reptester1") failed: Name or service not known
[rsHealthPoll] couldn't connect to reptester1:27017: couldn't connect to server reptester1:27017 (0.0.0.0) failed, address resolved to 0.0.0.0
[rsHealthPoll] replset info reptester1:27017 just heartbeated us, but our heartbeat failed: , not changing state
[rsHealthPoll] getaddrinfo("reptester1") failed: Name or service not known

有什么想法我做错了什么?

2 回答

  • 0

    你可以调试下面的东西 -

    • 从两台机器(即主要和次要)相互telnet mongo端口 . 检查它是否正常工作 .

    • 我相信,在副本配置中,您使用rs.add(“reptester2”)添加辅助服务器 . 请检查您的/ etc / hosts文件,ipaddress < - >主机映射应该存在于主计算机和辅助计算机中 .

    • 如果在主配置和辅助配置中都使用bind_ip . 然后在主机(/ etc / hosts)文件或rs.add(“IP地址”)中使用该IP地址 . 请不要使用像127.0.0.1这样的本地IP地址 .

  • 0

    这是一个dns概率,因为成员[0]名称是Reptest1,辅助服务器解析地址广告重新测试,而不是IP地址或DNS地址 . 我编辑了会员主持人地址 . 他们开始互相联系 . 我是通过使用它做到的

    $conf = rs.conf()
    $conf.members[0].host = "mongo.cloudapp.net:27017"
    rs.reconfig($conf)
    

相关问题