复制品之间的mongodb keyFile抛出权限被拒绝

时间:2015-05-20 01:30:21

标签: mongodb

我有一个带有auth激活的单个节点ReplicaSet,一个root用户和一个用discussion创建的keyFile,我在同一个服务器上还有两个mongod进程在不同的端口(37017和47017)和相同的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在每个配置文件中都是相同的,这就是所有需要的教程状态,但显然是不见了。

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

1 个答案:

答案 0 :(得分:0)

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