无法使用 MongoDB 3 配置副本集

Ofi*_*fir 5 replication mongodb replica-set

我正在尝试在 MongoDB 3.04 版中创建副本集。我遵循本教程并在尝试使用主服务器添加节点时遇到下一个错误:

vacrep:PRIMARY> rs.add('server address here')
{
    "ok" : 0,
    "errmsg" : "Quorum check failed because not enough voting nodes responded;
     required 2 but only the following 1 voting nodes responded: PRIMARYSERVER:27017; 
     the following nodes did not respond affirmatively: 'server address here':27017 
     failed with Missing credentials for authenticating as internal user",
     "code" : 74
}
Run Code Online (Sandbox Code Playgroud)

这是到目前为止所做的:

  1. 使用 MongoDB 3.04 安装 3 个服务器
  2. 使用 repSet 模式运行所有 MongoDB 实例
  3. 使用此方法验证服务器之间的连接
  4. 在主服务器中启动一个副本)

我发现有关此错误的线程很少,但在其中任何一个中都找不到解决方案。我该如何解决这个问题?

Ofi*_*fir 3

找到解决方案 - 这是权限问题。

在 MongoDB 配置文件中,我必须关闭身份验证模式或使用本指南在所有节点之间创建共享密钥:

https://docs.mongodb.com/manual/tutorial/deploy-replica-set-with-keyfile-access-control/#deploy-repl-set-with-auth

这就是我的服务器无法相互通信的原因。