配置MongoDB副本集

时间:2018-11-30 16:51:15

标签: mongodb configuration mongodb-query replication replicaset

当前,我有两个MongoDB实例,在第一个MongoDB(192.168.17.20)上,我已成功将其设置为主副本集,并且该数据库的身份验证已启用SSL。

我正在尝试将另一个VM上的第二个MongoDB实例(192.168.17.21也称为WIN-NJT7FNIGR90)添加到副本集,但是出现以下错误:

PRIMARY> rs.add("WIN-NJT7FNIGR90:27018")
{
        "ok" : 0,
        "errmsg" : "Quorum check failed because not enough voting nodes 
responded; required 2 but only the following 1 voting nodes responded: 
192.168.17.20:27017; the following nodes did not respond affirmatively: WIN- 
   NJT7FNIGR90:27018 failed with No connection could be made because the target 
machine actively refused it.",
    "code" : 74,
    "codeName" : "NodeNotFound",
    "operationTime" : Timestamp(1543594025, 1),
    "$clusterTime" : {
            "clusterTime" : Timestamp(1543594025, 1),
            "signature" : {
                    "hash" : BinData(0,"7XMqy78kJ1sp077O8OG/rBbj9Qo="),
                    "keyId" : NumberLong("6629676690215796737")
            }
    }
}

以下是配置文件参数:

主要MongoDB:

dbpath=C:\data\db
bind_ip = 127.0.0.1,192.168.17.20
port = 27017
journal=true
auth = true
sslMode = requireSSL
sslPEMKeyFile = C:\mongodb.pem
replSet = test

次要MongoDB:

dbpath=C:\data\db 
storageEngine=wiredTiger 
bind_ip=127.0.0.1,192.168.17.21
port = 27018
journal=true
replSet = test

我还将两个机器名称/ IP添加到了主机文件中,并禁用了防火墙。

对于解决错误和成功添加辅助replset的任何帮助,我们表示赞赏

0 个答案:

没有答案