在我的mongod.log中有很多错误:
2017-07-05T11:12:23.211+0200 I ACCESS [conn788] SCRAM-SHA-1 authentication failed for admin on admin from client 123.123.123.123 ; AuthenticationFailed: SCRAM-SHA-1 authentication failed, storedKey mismatch
我在
中运行了三个成员的副本集mongod-db.version()
3.2.11
我已经通过
添加了管理员用户MongoDB shell version: 3.2.11
connecting to: 127.0.0.1/test
clustername:PRIMARY> use admin
switched to db admin
clustername:PRIMARY> db.createUser( { user: "admin",
... pwd: "password",
... roles: [ "root",
... "userAdminAnyDatabase",
... "dbAdminAnyDatabase",
... "readWriteAnyDatabase"
...
... ] } )
Successfully added user: {
"user" : "admin",
"roles" : [
"root",
"userAdminAnyDatabase",
"dbAdminAnyDatabase",
"readWriteAnyDatabase"
]
}
在每个副本成员上,我可以输入mongo shell作为管理员执行
clustername:PRIMARY> db.auth("admin","password")
1
replica-nodes config仅在外部接口的bind-section中有所不同。
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
net:
port: 27017
bindIp: 123.123.123.123,127.0.0.1
security:
keyFile: /etc/ssl/mongo_keyfile
authorization: enabled
replication:
replSetName: clustername
mongo-user可以访问密钥文件。每个节点上的权限和所有权都相同。 md5shum也是一样的。
知道可能出现什么问题吗?