【发布时间】:2018-09-20 12:14:07
【问题描述】:
我已成功通过私有 IP 在 3 台服务器上启动了 MongoDB 4 副本集。现在我想绑定另一个 IP,它需要启用 TLS/SSL。
我已经创建了 PEMKeyFile 和 CAFile 并将这些文件复制到所有 3 台服务器上,并将以下代码添加到所有 3 台服务器的 mongod.config 文件中。
# network interfaces
net:
port: 27017
bindIp: 10.10.20.21,5.22.25.45 # example private ip and one example valid IP
ssl:
mode: requireSSL
PEMKeyFile: /opt/mongo/mongo.pem
PEMKeyPassword: MyPassword
CAFile : /opt/mongo/CA.pem
allowInvalidCertificates: true
allowInvalidHostnames: true
security:
keyFile: /opt/mongo/mongo-keyfile
我有错误
E STORAGE [initandlisten] Failed to set up listener: SocketException: Cannot assign requested address
I CONTROL [initandlisten] now exiting
I CONTROL [initandlisten] shutting down with code:48
它有什么问题?我该如何解决?
【问题讨论】:
-
您能否确认两个接口都有效,即在实例上执行的
ifconfig显示 10.10.20.21 和 5.22.25.45 ? -
10.10.20.21 是私有 IP,如果这个集群实例和 5.22.25.45 是服务器的有效 IP 是我的应用程序在那里并且想要连接。我应该在这个 mongo 集群服务器的 ifconfig 中看到这两个 IP 吗?
标签: mongodb ssl replication replicaset