【发布时间】:2021-01-13 21:45:11
【问题描述】:
MongoDB 版本:v4.2.7
Robo 3T 版本:v1.3.1
数据库管理员中有两个用户,一个具有内置角色“userAdminAnyDatabase”,另一个具有“readAnyDatabase”。我可以使用具有“userAdminAnyDatabase”角色的用户通过 Robo 3T 连接到 mongodb,没有任何问题。但是,当我使用带有“readAnyDatabase”的用户时,我无法连接到 mongodb,并出现以下错误。
以下是我启动连接时在 MongoDB 上的日志。它在通过身份验证后立即终止会话。
2020-09-28T17:37:57.065+0800 I NETWORK [listener] connection accepted from 10.212.135.200:57344 #23102882 (554 connections now open)
2020-09-28T17:37:57.066+0800 I NETWORK [conn23102882] received client metadata from 10.212.135.200:57344 conn23102882: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.5-17-gd808df2233" }, os: { type: "Windows", name: "Microsoft Windows 8", architecture: "x86_64", version: "6.2 (build 9200)" } }
2020-09-28T17:37:57.125+0800 I ACCESS [conn23102882] Successfully authenticated as principal soc on admin from client 10.212.135.200:57344
2020-09-28T17:37:57.170+0800 I NETWORK [listener] connection accepted from 10.212.135.200:57345 #23102883 (555 connections now open)
2020-09-28T17:37:57.171+0800 I NETWORK [conn23102883] received client metadata from 10.212.135.200:57345 conn23102883: { application: { name: "robo3t" }, driver: { name: "MongoDB Internal Client", version: "4.0.5-17-gd808df2233" }, os: { type: "Windows", name: "Microsoft Windows 8", architecture: "x86_64", version: "6.2 (build 9200)" } }
2020-09-28T17:37:57.224+0800 I NETWORK [listener] connection accepted from 10.212.135.200:57346 #23102884 (556 connections now open)
2020-09-28T17:37:57.225+0800 I NETWORK [conn23102884] received client metadata from 10.212.135.200:57346 conn23102884: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.5-17-gd808df2233" }, os: { type: "Windows", name: "Microsoft Windows 8", architecture: "x86_64", version: "6.2 (build 9200)" } }
2020-09-28T17:37:57.283+0800 I ACCESS [conn23102884] Successfully authenticated as principal soc on admin from client 10.212.135.200:57346
2020-09-28T17:37:57.320+0800 I NETWORK [conn23102882] end connection 10.212.135.200:57344 (555 connections now open)
2020-09-28T17:37:57.339+0800 I NETWORK [conn23102883] end connection 10.212.135.200:57345 (554 connections now open)
2020-09-28T17:37:57.512+0800 I NETWORK [conn23102884] end connection 10.212.135.200:57346 (553 connections now open)
我尝试在连接中添加一个集合名称作为错误提示,连接时间比上一个要长得多,而且错误有点不同。
2020-09-28T17:58:34.823+0800 I NETWORK [listener] connection accepted from 10.212.135.200:57925 #23118931 (587 connections now open)
2020-09-28T17:58:34.833+0800 I NETWORK [conn23118931] received client metadata from 10.212.135.200:57925 conn23118931: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "4.0.5-17-gd808df2233" }, os: { type: "Windows", name: "Microsoft Windows 8", architecture: "x86_64", version: "6.2 (build 9200)" } }
2020-09-28T17:58:34.893+0800 I ACCESS [conn23118931] Successfully authenticated as principal soc on admin from client 10.212.135.200:57925
也许我配置错误?有人有想法吗?
【问题讨论】: