连接后,mongobee 在 Atlas 集群上读取 DBname.system.indexes 失败 [英] Reading of DBname.system.indexes failed on Atlas cluster by mongobee after getting connected

查看:20
本文介绍了连接后,mongobee 在 Atlas 集群上读取 DBname.system.indexes 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Jhipster Spring Boot 项目.最近我从 mlabs 独立沙箱转移到 Atlas 集群沙箱 M0 免费层副本集.它甚至可以工作,我已经对它进行了一些数据库操作.但是现在由于某种原因然后出现了读取权限错误

I have a Jhipster Spring boot project. Recently I shifted from mlabs standalone sandboxes to Atlas cluster sandbox M0 Free tier replica set. It even worked and I had made some database operations on it. But now for some reason then there is a read permission error

Error creating bean with name 'mongobee' defined in class path resource [DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoQueryException: Query failed with error code 8000 and error message 'user is not allowed to do action [find] on [test.system.indexes]' on server ********-shard-00-01-mfwhq.mongodb.net:27017

您可以在此处查看完整堆栈https://pastebin.com/kaxcr7VS

You can see the full stack here https://pastebin.com/kaxcr7VS

我搜索了高低,我能找到的只是 M0 层用户没有权限覆盖我没有做的管理数据库.

I have searched high and low and all I could find is that M0 tier user doesn't have permissions to overwrite admin database which I am not doing.

即使现在连接到 Mlabs DB 也能正常工作,但在 Atlas DB M0 层上存在此问题.

Even now connection to Mlabs DB works fine but have this issue on Atlas DB M0 tier.

Mongo DB 版本:3.4

Mongo DB version : 3.4

罐子和它的版本名称:'mongobee',版本:'0.10'名称:'mongo-java-driver',版本:'3.4.2'

Jars and It's version name: 'mongobee', version: '0.10' name: 'mongo-java-driver', version: '3.4.2'

@尼尔伦我用来连接的用户 ID 是管理员的用户 ID,连接读写通过 shell 或 Robo3T(mongo 客户端)进行

@Neil Lunn The userId I am using to connect is that of admin's and the connection read and write works through shell or Robo3T(mongo client)

推荐答案

在与 MongoDB 支持团队讨论后,MongoDB 3.0 弃用了对 system.indexes 集合的直接访问,该集合以前用于列出数据库中的所有索引.应用程序应该使用 db..getIndexes() 代替.

After discussion with MongoDB support team, MongoDB 3.0 deprecates direct access to the system.indexes collection, which had previously been used to list all indexes in a database. Applications should use db.<COLLECTION>.getIndexes() instead.

来自 MongoDB Atlas 文档可以看出他们可能禁止调用 system. 集合:

From MongoDB Atlas docs it can be seen that they may forbid calls to system. collections:

可选地,对于 read 和 readWrite 角色,您还可以指定一个集合.如果不指定read和readWrite的集合,则该角色适用于数据库中的所有集合(不包括一些system.collections).

Optionally, for the read and readWrite role, you can also specify a collection. If you do not specify a collection for read and readWrite, the role applies to all collections (excluding some system. collections) in the database.

从堆栈跟踪可以看出 MongoBee 正在尝试进行此调用,因此现在是库问题并且应该更新.

From the stacktrace it's visible that MongoBee is trying to make this call, so it's now the library issue and it should be updated.

更新:为了在 MongoBee 发布新版本之前修复问题:

UPDATE: In order to fix an issue until MongoBee has released new version:

  1. 获取MongoBee的最新源码git clone git@github.com:mongobee/mongobee.git, cd mongobee
  2. 获取拉取请求 git fetch origin pull/87/head:mongobee-atlas
  3. 结帐git checkout mongobee-atlas
  4. 安装 MongoBee jar mvn clean install
  5. /target文件夹或本地/.m2
  6. 获取编译好的jar
  7. 使用 jar 作为项目的依赖项
  1. Get the latest sources of MongoBee git clone git@github.com:mongobee/mongobee.git, cd mongobee
  2. Fetch pull request git fetch origin pull/87/head:mongobee-atlas
  3. Checkout git checkout mongobee-atlas
  4. Install MongoBee jar mvn clean install
  5. Get compiled jar from /target folder or local /.m2
  6. Use the jar as a dependency on your project

这篇关于连接后,mongobee 在 Atlas 集群上读取 DBname.system.indexes 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆