【问题标题】:mongodb keyFile between replicas throws Permission denied副本之间的mongodb keyFile抛出权限被拒绝
【发布时间】:2023-03-18 00:42:01
【问题描述】:

我有一个激活 auth 的单节点 ReplicaSet、一个 root 用户和一个我用 this tutorial 创建的 keyFile,我在同一服务器上还有两个不同端口(37017 和 47017)的 mongod 进程,并且相同replSet 名称,但是当我尝试在使用 rs.add("172.31.48.41:37017") 连接到 PRIMARY 的 mongo shell 中添加辅助节点时,我得到:

{
    "ok" : 0,
    "errmsg" : "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: 172.31.48.41:27017; the following nodes did not respond affirmatively: 172.31.48.41:37017 failed with Failed attempt to connect to 172.31.48.41:37017; couldn't connect to server 172.31.48.41:37017 (172.31.48.41), connection attempt failed",
    "code" : 74
}

然后我去PRIMARY的mongod进程日志发现了这个:

2015-05-19T20:53:59.848-0400 I REPL     [conn51] replSetReconfig admin command received from client
2015-05-19T20:53:59.848-0400 W NETWORK  [conn51] Failed to connect to 172.31.48.41:37017, reason: errno:13 Permission denied
2015-05-19T20:53:59.848-0400 I REPL     [conn51] replSetReconfig config object with 2 members parses ok
2015-05-19T20:53:59.849-0400 W NETWORK  [ReplExecNetThread-0] Failed to connect to 172.31.48.41:37017, reason: errno:13 Permission denied
2015-05-19T20:53:59.849-0400 W REPL     [ReplicationExecutor] Failed to complete heartbeat request to 172.31.48.41:37017; Location18915 Failed attempt to connect to 172.31.48.41:37017; couldn't connect to server 172.31.48.41:37017 (172.31.48.41), connection attempt failed
2015-05-19T20:53:59.849-0400 E REPL     [conn51] replSetReconfig failed; NodeNotFound Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: 172.31.48.41:27017; the following nodes did not respond affirmatively: 172.31.48.41:37017 failed with Failed attempt to connect to 172.31.48.41:37017; couldn't connect to server 172.31.48.41:37017 (172.31.48.41), connection attempt failed

而应该成为 SECONDARY 的 mongod 的日志什么也没有显示,最后两行是:

2015-05-19T20:48:36.584-0400 I REPL     [initandlisten] Did not find local replica set configuration document at startup;  NoMatchingDocument Did not find replica set configuration document in local.system.replset
2015-05-19T20:48:36.591-0400 I NETWORK  [initandlisten] waiting for connections on port 37017

很明显,我不能在此节点中使用 rs.initiate(),因为它会自行投票为 PRIMARY,这会产生冲突,因此“启动时未找到本地副本集配置文档”的行是据我所知,被忽略了。

所以我认为权限应该没问题,因为我在每个 mongod 进程中使用相同的密钥文件,并且每个配置文件中的 replSet 都是相同的,这就是需要的所有教程状态,但显然有些东西不见了。

有什么想法吗?这是一个错误吗?

【问题讨论】:

    标签: mongodb


    【解决方案1】:

    如果您在两个实例的安全组中使用 ec2 实例和 ip 27017 端口,只需添加一个辅助实例端口。它对我有用。

    【讨论】:

      猜你喜欢
      • 2011-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-28
      • 1970-01-01
      • 1970-01-01
      • 2015-08-30
      相关资源
      最近更新 更多