0

我们有一个来自阿里云的 MongoDB 副本集。我们将 MongoDB URL 设置为

mongodb://username:password@dds-xxxxx-pub.mongodb.rds.aliyuncs.com:3717,dds-xxxxx-pub.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-xxxxx

当服务器启动时,ReactiveMongo 抛出错误:

Invalid node status Primary for dds-2zedbafbdcdae6541787-pub.mongodb.rds.aliyuncs.com:3717 (expected: Unknown); Fallback to Unknown status

我查看了 ReactiveMongo 的源代码,但不明白为什么它处于预期unknown状态?

upSet.updateAll { n =>
          if (node.names.contains(n.name) && // the node itself
            n.status != node.status) {
            // invalidate node status on status conflict
            warn(s"Invalid node status ${node.status} for ${node.name} (expected: ${n.status}); Fallback to Unknown status")

            n._copy(status = NodeStatus.Unknown)
          } else n
        }
4

1 回答 1

0

replicaSet忽略该选项后,它对我们有用。

http://reactivemongo.org/releases/0.1x/documentation/tutorial/alibaba-apsaradb.html

最后对于 ReactiveMongo 连接,replicaSet 选项可以从 URI 中删除,密码占位符必须替换为实际值。

mongodb.uri = "mongodb://root:${APSARADB_PASSWORD}@dds-4e6322c0290348c49176-pub.mongodb.germany.rds.aliyuncs.com:3717/${APSARADB_DBNAME}"

于 2019-11-19T03:10:39.880 回答