我们有一个来自Ali Cloud的MongoDB副本集。我们将MongoDB URL设置为
mongodb://username:[email protected]: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
}
[忽略replicaSet
选项后,它对我们有用。
http://reactivemongo.org/releases/0.1x/documentation/tutorial/alibaba-apsaradb.html
最后是ReactiveMongo连接,可以从URI中删除copysetSet选项,并且必须用实际值替换密码占位符。
mongodb.uri =“ mongodb:// root:$ {APSARADB_PASSWORD} @ dds-4e6322c0290348c49176-pub.mongodb.germany.rds.aliyuncs.com:3717 / $ {APSARADB_DBNAME}”]