【问题标题】:Test Connections Between all Members Fails测试所有成员之间的连接失败
【发布时间】:2017-05-18 15:13:58
【问题描述】:

我在 mongodb 中设置了三个成员的副本集。 副本集的所有三个成员都在运行 mongod 实例 Active: active (running)

但是当我尝试使用检查连接时

mongo --host 172.x.x.x --port 27017

按照https://docs.mongodb.com/manual/tutorial/troubleshoot-replica-sets/#replica-set-troubleshooting-check-connection 上给出的说明,我明白了,

MongoDB shell version v3.4.4
connecting to: mongodb://172.x.x.x:27017/
2017-05-18T10:11:01.466-0500 W NETWORK  [thread1] Failed to connect to 172.x.x.x:27017, in(checking socket for error after poll), reason: Connection refused
2017-05-18T10:11:01.467-0500 E QUERY    [thread1] Error: couldn't connect to server 172.x.x.x:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

因此我无法执行 rs.add(),我总是收到服务器上的错误没有响应

请帮忙!!

【问题讨论】:

  • 中间有防火墙吗? 27017 端口打开了吗?

标签: mongodb database-replication database-administration replicaset


【解决方案1】:

这是我尝试连接的主机的 mongo.conf 的问题,

默认配置是:

net:
  port: 27017
  bindIp: 127.0.0.1

我通过添加我的服务器的私有 IP 来更改它,或者您可以评论 bindId 以接受来自所有人的请求:

net:
  port: 27017
  bindIp: [127.0.0.1,172.x.x.x]

net:
  port: 27017
  #bindIp: 127.0.0.1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-06-28
    • 2017-05-04
    • 2012-11-07
    • 1970-01-01
    • 2016-09-05
    • 1970-01-01
    • 2021-01-28
    相关资源
    最近更新 更多