AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题 / 324286
Accepted
Gryu
Gryu
Asked: 2023-03-02 22:25:15 +0800 CST2023-03-02 22:25:15 +0800 CST 2023-03-02 22:25:15 +0800 CST

导入大 mongodb bson 存档 > 300Mb

  • 772

我在 Ubuntu 20.04 上以下一种方式安装了 mongodb:

wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt update
sudo apt install mongodb-org

然后我下载了示例 mongodb 数据库:

wget https://atlas-education.s3.amazonaws.com/sampledata.archive

但我不知道如何在 Ubuntu 上导入它。我已经使用 Studio 3T 应用程序将它导入到 Windows 上。此外,如果我在我的远程 ubuntu 服务器上配置身份验证,在防火墙中打开所需端口并在 /etc/mongod.conf 中的 0.0.0.0 上启用 mongodb 绑定,则可以通过从 Windows 使用此应用程序来完成。

但是在 Ubuntu 上,当我将它重命名为sampledata.archive.bson并尝试导入它时,我得到了下一个带有错误的输出:

user@server:~/projects/mongodb_sample_db$ mongorestore sampledata.archive.bson
2023-03-02T15:21:00.155+0100    checking for collection data in sampledata.archive.bson
2023-03-02T15:21:00.155+0100    restoring to existing collection test.sampledata.archive without dropping
2023-03-02T15:21:00.155+0100    restoring test.sampledata.archive from sampledata.archive.bson
2023-03-02T15:21:00.201+0100    finished restoring test.sampledata.archive (0 documents, 0 failures)
2023-03-02T15:21:00.201+0100    Failed: test.sampledata.archive: error restoring from sampledata.archive.bson: reading bson input: invalid BSONSize: -2120621459 bytes is less than 5 bytes
2023-03-02T15:21:00.201+0100    0 document(s) restored successfully. 0 document(s) failed to restore.

可能的错误原因:文件太大:

4983289 -rw-rw-r--  1 user user 305M Mar 10  2022 sampledata.archive.bson

我怎样才能导入它?

mongodb
  • 1 1 个回答
  • 17 Views

1 个回答

  • Voted
  1. Best Answer
    Wernfried Domscheit
    2023-03-03T17:53:53+08:002023-03-03T17:53:53+08:00

    查看MongoDB Atlas 样本数据集

    对我来说它有效:

    mongorestore.exe --uri="mongodb://admin:*****@localhost:27017/?authSource=admin" --archive=sampledata.archive
    
    2023-03-03T10:50:50.768+0100    preparing collections to restore from
    ...
    2023-03-03T10:51:03.840+0100    424065 document(s) restored successfully. 0 document(s) failed to restore.
    
    • 1

相关问题

  • Mongo Map-Reduce 还是分片?

  • 使用集群设置 Mongo

  • MongoDB 的 find 和 findone 调用之间的区别

  • 分片对小集合有效吗?

  • 关于操作/管理 MongoDB 的良好资源

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve