当我将第二个节点添加到现有副本集时,出现以下错误:
{
"ok"=>0.0,
"errmsg"=>"Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: devshard1s1:27018; the following nodes did not respond affirmatively: devshard1s2:27018 failed with command replSetHeartbeat requires authentication",
"code"=>74,
"codeName"=>"NodeNotFound"
}
无法通过命令replSetHeartbeat进行身份验证
我启用了SSL,启用了授权,还启用了集群身份验证: /etc/mongodb.conf中的代码段
net:
port: 27018
bindIp: 0.0.0.0
ssl:
mode: requireSSL
PEMKeyFile: "/etc/mongodb/ssl/cluster-cert.pem"
CAFile: "/etc/mongodb/ssl/ca-cert.pem"
clusterFile: "/etc/mongodb/ssl/cluster-cert.pem"
security:
clusterAuthMode: x509
authorization: enabled
devshard1s1(第一个节点)中我的CN名称和SAN是:
Subject: CN=10.0.41.239, DC=dev
X509v3 Subject Alternative Name:
DNS:devshard1s1, IP Address:10.0.41.239, IP Address:127.0.0.1, DNS:localhost
devshard1s2(第二个节点)中我的CN名称和SAN是:
Subject: CN=10.0.12.231, DC=dev
X509v3 Subject Alternative Name:
DNS:devshard1s2, IP Address:10.0.12.231, IP Address:127.0.0.1, DNS:localhost
也在PRIMARY节点(devshard1s1)中,日志具有以下内容:
2019-01-29T13:57:57.639+0000 I NETWORK [conn2131] can't authenticate to devshard1s2:27018 as internal user, error: Could not find user CN=10.0.41.239/DC=dev@$external
MongoDB版本: 4.0
注意:
我正在按照下面的方法进行安装(使用厨师)
1.从副本集安装第一个节点,因为它是第一个,所以请初始化副本集,使其成为主节点。
2.在具有根角色的该节点上添加管理员用户。
3.由于副本集已经初始化,因此从副本集安装第二个节点,请连接到PRIMARY,并使用此节点详细信息对副本集进行身份验证和重新配置。
4.重新配置replicset时出现上述错误:Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: devshard1s1:27018; the following nodes did not respond affirmatively: devshard1s2:27018 failed with command replSetHeartbeat requires authentication