首页 > 解决方案 > 当 db 在 diff (27020) 端口中创建时,无法从 robo3T 访问 mongodb 集合。(能够连接到 db 但不能连接到 coll)

问题描述

error_img config_27017 config_27020 我正在尝试从一个数据库中提取数据(在端口 27017 中运行)并将提取的数据存储在另一个数据库中(27020)。对于第一个分贝,我设置了身份验证,但没有为第二个分贝设置。我在 aws 实例中安装了 mongodb。我在不同的端口(即 27017、27020)中创建每个数据库。为每个端口创建单独的 mongo_config 文件。能够从 robo3T 访问新创建的数据库,但是访问集合会出现以下错误:

**Error "ListCollection failed: {ok: 0.0, errmsg: "not authorized on <db> to execute command {listCollection:1, filter: {}, cursor: {}, $readPreference: {mode: "secondaryPreferred"}. $d..". code:13, codeName: "Unauthorized"}"}**

请建议我创建 2 个 mongo 实例的步骤,在一台服务器上监听 2 个不同的端口。

标签: databasemongodbpymongorobo3t

解决方案


推荐阅读