简体   繁体   English

MongoDB副本集Healtcheck-HostUnreachable

[英]MongoDB Replica Set Healtcheck - HostUnreachable

I've been having trouble setting up my Mongo v3.2 replica set / cluster. 我在设置Mongo v3.2副本集/群集时遇到了麻烦。 I've included mongod s logs with inline comments from A) the node I initialized the replica set from and B) another node (rest of peers are having same issue). 我已经在mongod的日志中添加了以下注释:A)我从中初始化副本集的节点和B)另一个节点(其他对等节点都存在相同问题)。 In short, the issue is that the heartbeat from all the other nodes to the node I initially setup the replica set from keep failing due to HostUnreachable, but I'm not sure how to debug further, as mongo <initial node> works fine from all the other nodes so I don't think it's a network access problem. 简而言之,问题是从所有其他节点到我最初设置副本集的节点的心跳都不会因HostUnreachable而失败,但是我不确定如何进一步调试,因为mongo <initial node>在所有其他节点,所以我认为这不是网络访问问题。 After some Googling, I assumed this was due to the bindIp setting I had in my Mongo config file (or the lack thereof), but listing all node IPs there doesn't seem to do the trick. 经过一番谷歌搜索后,我认为这是由于我在Mongo配置文件中设置了bindIp设置(或缺少该设置),但是列出所有节点IP似乎没有用。

See the mongodb config files & logs here- 在这里查看mongodb配置文件和日志-

https://gist.github.com/tejasmanohar/f0e705fb0d9e96f68e05e1ab20c478be https://gist.github.com/tejasmanohar/f0e705fb0d9e96f68e05e1ab20c478be

Why could this healthcheck be failing and/or how I can debug further or maybe reproduce the failed connection apart outside of mongod (I can ping and connect via mongo to all peers from each host)? 为什么此运行状况检查会失败和/或如何进一步调试,或者可能在mongod之外分开重现失败的连接(我可以ping并通过mongo连接到每个主机的所有对等方)? Thanks! 谢谢!

Update: options: { config: "/etc/mongod.conf", net: { bindIp: true }, replication: { replSet: "rs0" } } I noticed that the mongod logs show bindIp: true rather than a list set in my Mongo configuration file. 更新: options: { config: "/etc/mongod.conf", net: { bindIp: true }, replication: { replSet: "rs0" } }我注意到mongod日志显示bindIp: true而不是列表中的列表我的Mongo配置文件。 Is that problematic? 那有问题吗? I tried providing a comma-separated string instead of an array since the type of the field is a bit unclear in docs but same result. 我尝试提供逗号分隔的字符串而不是数组,因为在文档中字段类型有点不清楚,但结果相同。

It seems you are setting the ips of the other machines on bindIp, but you should use the machine's ip that is reachable by the others. 似乎您在bindIp上设置了其他机器的ip,但是您应该使用其他机器可以访问的机器的ip。

For example, on your mongo-initial.q machine, your bindIp should be like: 例如,在mongo-initial.q机器上,bindIp应该类似于:

"bindIp": "127.0.0.1,10.0.11.2"

More info here . 更多信息在这里

Don't know if it will fix everything but it's a start. 不知道它是否可以解决所有问题,但这只是一个开始。

So, the solution doesn't make 100% sense to me yet, but I had to change bindIps setting to a comma-separated string instead of an array. 因此,该解决方案对我来说还不是100%有意义,但是我不得不将bindIps设置更改为以逗号分隔的字符串而不是数组。 Array seems to work in YAML but not JSON. 数组似乎可以在YAML中工作,但不能在JSON中工作。 Still don't understand why it logged out as a bool before. 仍然不明白为什么以前以笨蛋的身份登出。 @andresk pointed out something else wrong about my solution-- my bindIp setting had my peer IPs but not the own host. @andresk指出了我的解决方案的其他问题-我的bindIp设置具有我的对等IP,但没有自己的主机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM