从Robo 3T成功验证后,MongoDB终止连接

时间:2020-09-28 09:59:55

标签: mongodb robo3t

MongoDB版本:v4.2.7

Robo 3T版本:v1.3.1

db admin中有两个用户,一个用户具有内置角色“ userAdminAnyDatabase”,另一个用户具有“ readAnyDatabase”。我可以使用具有“ userAdminAnyDatabase”角色的用户通过Robo 3T连接到mongodb,而不会出现任何问题。但是,当我将用户与“ readAnyDatabase”一起使用时,由于以下错误,我无法连接到mongodb。

enter image description here

下面是我启动连接时在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)

我试图在连接中添加一个设置名称作为错误提示,并且连接时间比上一个更长,并且错误也有所不同。

enter image description here

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

也许我配置错误?有人有主意吗?

1 个答案:

答案 0 :(得分:0)

对于第一个错误,请在配置中提供副本集名称。

对于第二个错误,您可能是主机名错误。

使用mongo shell验证连接是否有效。