关于mongodb复制集管理秘钥文件认证启动失败解决方案
[root@bogon bin]# mongod -f /etc/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 8670
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the "--fork" option.
PRIMARY> use admin
db.createUser({“user”:“root”,“pwd”:“123”,“roles”:[“root”]}) 创建root用户
vim /etc/mongod.conf security:
keyFile: /usr/bin/kgcrskey1 #验证文件路径
clusterAuthMode: keyFile #验证模式:密钥文件
在这里设置完每个复制集的配置文件后,添加秘钥文件
//设置密钥文件,内容相同
cd /usr/bin
echo “kgcrs key” >kgcrskey1
echo “kgcrs key” >kgcrskey2
echo “kgcrs key”> kgcrskey3
echo “kgcrs key”> kgcrskey4
mongod -f /etc/mongod.conf --shutdown 先停止服务
mongod -f /etc/mongod/conf
报错如下
[root@bogon bin]# mongod -f /etc/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 8670
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the "--fork" option.
解决方案
原因是权限不对,所以修改秘钥文件的权限
cd /usr/bin
chmod 600 kgc*
启动成功