在分片群集上启用访问控制后,我能够通过端口27018(mongodb)上的mongo成功进行身份验证,并且能够执行所有操作,但是在通过端口27017(mongos)上的路由器进行交互时遇到问题。你能帮我解决我做错的地方吗?下面是通过路由器连接时的堆栈跟踪(因为最终用户需要使用分片群集的路由器URL)
-bash-4.2$ bin/mongo --host `hostname` --port 27017
MongoDB shell version v4.0.6
MongoDB server version: 4.0.6
MongoDB Enterprise mongos> show dbs
MongoDB Enterprise mongos> use test
switched to db test
MongoDB Enterprise mongos> sh.status()
2020-01-20T20:57:25.527-0800 E QUERY [js] Error: error: {
"ok" : 0,
"errmsg" : "command find requires authentication",
"code" : 13,
"codeName" : "Unauthorized",
我还尝试了db.auth()无效,并且命令行选项也尝试了。
现在也意识到在mongod实例上也会出现一些错误。
these commands getting errors
db.help()
db.mycoll.help()
sh.help()
rs.help()
and these are not
show dbs
show collections
show users
show profile
show logs
show log [name]
use <db_name>
如果我执行rs.status(),我将跌倒
"errmsg" : "not authorized on admin to execute command