在Windows平台无法部署MongoDB副本集。

huangapple go评论61阅读模式
英文:

Unable to delpoy MongoDB replica set in windows platform

问题

我正在努力在同一网络中的三台Windows平台计算机上部署一个副本集,所以我为每台计算机创建了如下的计算机名称:

1.) DESKTOP-MONGO01:27017
2.) DESKTOP-MONGO02:27017
3.) DESKTOP-MONGO03:27017

我正在尝试使用cmd连接第二台计算机:

C:\DESKTOP-MONGO01>mongo "DESKTOP-MONGO02:27017"
MongoDB shell版本 v5.0.6
正在连接到:mongodb://DESKTOP-MONGO02:27017/test?compressors=disabled&gssapiServiceName=mongodb
错误:无法连接到服务器 DESKTOP-MONGO02:27017,连接尝试失败:网络超时:连接到DESKTOP-MONGO02:27017 (10.25.35.96:27017) 出错:由于:套接字操作超时:
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
异常:连接失败
以代码1退出

配置文件中的网络设置:

net:
  port: 27017
  bindIp: 127.0.0.1,DESKTOP-MONGO02

所有三台计算机使用相同的Mongo版本/相同的网络,但我无法从第一台计算机连接第二台或第三台计算机。

问题在于Mongo能够看到计算机的私有IP(10.25.35.96),但无法连接进行测试或将这些节点添加到副本集中,如果是第二/第三台计算机的防火墙问题,如何在Windows防火墙中解决?

感谢您的帮助。

英文:

I am working to deploy a replica set in three windows platform computers in the same network so I created the computer-name for each one like the following:

1.) DESKTOP-MONGO01:27017
2.) DESKTOP-MONGO02:27017
3.) DESKTOP-MONGO03:27017

I am trying to connect the second computer by using cmd

C:\DESKTOP-MONGO01>mongo "DESKTOP-MONGO02:27017"
MongoDB shell version v5.0.6
connecting to: mongodb://DESKTOP-MONGO02:27017/test?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server DESKTOP-MONGO02:27017, connection attempt failed: NetworkTimeout: Error connecting to DESKTOP-MONGO02:27017 (10.25.35.96:27017) :: caused by :: Socket operation timed out :
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
exception: connect failed
exiting with code 1

Network in Config file

net:
  port: 27017
  bindIp: 127.0.0.1,DESKTOP-MONGO02

All the three computers are use the same mongo version / same network but I am not able to connect the second or the third computer from the first one.

The issue is the mongo is able to see the computer Private IP (10.25.35.96) but cannot connect it for testing or for adding these nodes to the replica set, and if it is firewall issue in the second/third computer haw to solve it in windows firewall?

Thanks for helping

答案1

得分: 0

通过在所有设备上将端口27017添加到白名单中,它正常工作。

英文:

by whiting list port 27017 in all devices its working fine.

huangapple
  • 本文由 发表于 2023年3月23日 10:17:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/75818760.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定