一、远程连接导出报错超时

mongodump -h 10.110.63.150:27017 -u'admin' -p'passwd!' --authenticationDatabase flowtest --db flowtest -o /home/mongod/bak > mongodump.log 2>&1 &
导出报错:
2022-11-17T18:58:54.663+0800 [###############.........] flowtest.processDataObj 68313/106962 (63.9%)
2022-11-17T18:58:56.506+0800 Failed: error writing data for collection `flowtest.processDataObj` to disk: error reading collection: connection pool for 10.110.63.150:27017 was cleared because another operation failed with: connection(10.110.63.150:27017[-2]) incomplete read of message header: read tcp 7.7.7.11:53305->10.110.63.150:27017: i/o timeout

二、本地导出不会超时

bin/mongodump -u'admin' -p'passwd!' --authenticationDatabase flowtest --db flowtest -o /home/nrms/thirdparty/mongodb/mongodb-linux-x86_64-3.6.13/bak > mongodump.log 2>&1 &
同时可见,导出不压缩,数据量比源目录大了很多,大约2倍,侧面说明了mongodb库本身的内部数据压缩效果不错:
1.4G data
2.8G bak
233M bak.tar

三、导入1个集合 history_task 到 testdb 库

mongorestore -h node1:20000 -u'liking' -p'passwd!2#' --authenticationDatabase testdb --db testdb --collection history_task /home/mongod/bak/flowtest/history_task.bson > mongorestore.log 2>&1 &

四、导入全部

mongorestore -h node1:20000 -u'admin' -p'passwd!2#' --authenticationDatabase admin --db flowtest /home/mongod/bak/flowtest > mongorestore.log 2>&1 &

五、导入日志分析

确定还原的集合列表,并读取各个集合的元数据:

2022-11-18T09:59:51.909+0800    The --db and --collection flags are deprecated for this use-case; please use --nsInclude instead, i.e. with --nsInclude=${DATABASE}.${COLLECTION}
2022-11-18T09:59:51.910+0800 building a list of collections to restore from /home/mongod/bak/flowtest dir
2022-11-18T09:59:51.911+0800 reading metadata for flowtest.history_task from metadata
2022-11-18T09:59:51.912+0800 reading metadata for flowtest.processConfiguration from metadata
2022-11-18T09:59:51.925+0800 reading metadata for flowtest.processDataObj from metadata
2022-11-18T09:59:51.930+0800 reading metadata for flowtest.processDataObjInit from metadata
2022-11-18T09:59:51.931+0800 reading metadata for flowtest.snapshotResource from metadata
2022-11-18T09:59:51.932+0800 reading metadata for flowtest.activityConfiguration from metadata
2022-11-18T09:59:51.945+0800 reading metadata for flowtest.processDataObjDraft from metadata
2022-11-18T09:59:51.945+0800 reading metadata for flowtest.processsDataObjInit from metadata
2022-11-18T09:59:51.946+0800 reading metadata for flowtest.role from metadata

同时开启4个并发 restoring:

2022-11-18T09:59:52.290+0800    restoring flowtest.snapshotResource
2022-11-18T09:59:52.335+0800 restoring flowtest.history_task
2022-11-18T09:59:52.369+0800 restoring flowtest.processDataObj
2022-11-18T09:59:52.396+0800 restoring flowtest.processDataObjInit

每 finished 1个,即再开始 restoring 另1个:

2022-11-18T09:59:52.824+0800    finished restoring flowtest.snapshotResource (790 documents, 0 failures)
2022-11-18T09:59:52.878+0800 restoring flowtest.processDataObjDraft
2022-11-18T09:59:53.096+0800 finished restoring flowtest.processDataObjDraft (123 documents, 0 failures)
2022-11-18T09:59:53.159+0800 restoring flowtest.activityConfiguration

每 finished 2个,即再开始 restoring 另2个:

2022-11-18T09:59:53.335+0800    finished restoring flowtest.activityConfiguration (1308 documents, 0 failures)
2022-11-18T09:59:53.382+0800 finished restoring flowtest.history_task (3629 documents, 0 failures)
2022-11-18T09:59:53.464+0800 restoring flowtest.processConfiguration
2022-11-18T09:59:53.544+0800 restoring flowtest.processsDataObjInit
2022-11-18T09:59:53.577+0800 finished restoring flowtest.processConfiguration (168 documents, 0 failures)
2022-11-18T09:59:53.622+0800 restoring flowtest.role from /home/mongod/bak/flowtest/role.bson
2022-11-18T09:59:55.108+0800 finished restoring flowtest.role (10 documents, 0 failures)
2022-11-18T09:59:55.108+0800 finished restoring flowtest.processsDataObjInit (4 documents, 0 failures)
2022-11-18T10:00:28.471+0800 finished restoring flowtest.processDataObjInit (96008 documents, 0 failures)
2022-11-18T10:00:45.768+0800 finished restoring flowtest.processDataObj (106968 documents, 0 failures)

开始恢复 indexes:

2022-11-18T10:00:45.781+0800    restoring indexes for collection flowtest.processDataObjInit from metadata
2022-11-18T10:00:45.799+0800 index: &idx.IndexDocument{Options:primitive.M{"name":"flowId_1_activityConfiguration.activityNameEn_1", "ns":"flowtest.processDataObjInit", "v":2}, Key:primitive.D{primitive.E{Key:"flowId", Value:1}, primitive.E{Key:"activityConfiguration.activityNameEn", Value:1}}, PartialFilterExpression:primitive.D(nil)}
2022-11-18T10:00:45.799+0800 no indexes to restore for collection flowtest.snapshotResource
2022-11-18T10:00:45.799+0800 no indexes to restore for collection flowtest.activityConfiguration
2022-11-18T10:00:45.799+0800 no indexes to restore for collection flowtest.history_task
2022-11-18T10:00:45.799+0800 restoring indexes for collection flowtest.processDataObj from metadata
2022-11-18T10:00:45.799+0800 index: &idx.IndexDocument{Options:primitive.M{"name":"flowId_1_activityConfiguration.activityNameEn_1", "ns":"flowtest.processDataObj", "v":2}, Key:primitive.D{primitive.E{Key:"flowId", Value:1}, primitive.E{Key:"activityConfiguration.activityNameEn", Value:1}}, PartialFilterExpression:primitive.D(nil)}
2022-11-18T10:00:45.799+0800 index: &idx.IndexDocument{Options:primitive.M{"name":"flowNo_1", "ns":"flowtest.processDataObj", "v":2}, Key:primitive.D{primitive.E{Key:"flowNo", Value:1}}, PartialFilterExpression:primitive.D(nil)}
2022-11-18T10:00:45.799+0800 no indexes to restore for collection flowtest.processsDataObjInit
2022-11-18T10:00:45.799+0800 no indexes to restore for collection flowtest.processConfiguration
2022-11-18T10:00:45.799+0800 no indexes to restore for collection flowtest.processDataObjDraft
2022-11-18T10:00:45.800+0800 index: &idx.IndexDocument{Options:primitive.M{"name":"flowNo_1", "ns":"flowtest.processDataObjInit", "v":2}, Key:primitive.D{primitive.E{Key:"flowNo", Value:1}}, PartialFilterExpression:primitive.D(nil)}
2022-11-18T10:00:45.800+0800 no indexes to restore for collection flowtest.role

最后的总结:恢复了 209008 document(s)

2022-11-18T10:00:48.031+0800    209008 document(s) restored successfully. 0 document(s) failed to restore.

MongoDB数据的导出导入及日志分析的更多相关文章

  1. mongodb数据的导出导入

    1.[导出]mongoexport -h (主机名) -d (库) -c (集合名) -o (路径) -u (账号) -p (密码)示例:mongoexport -h localhost -d jav ...

  2. Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(下)

    <Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(上)> <Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(下)> 目的:指导项 ...

  3. Oracle基础 数据泵导出/导入Expdp/impdp(转)

    一.EXPDP和IMPDP使用说明 Oracle Database 10g引入了最新的数据泵(Data Dump)技术,数据泵导出导入(EXPDP和IMPDP)的作用 1)实现逻辑备份和逻辑恢复. 2 ...

  4. 数据泵导出/导入Expdp/impdp

    一下转自 http://blog.csdn.net/jionjionyoushen/article/details/6789686 数据泵导出/导入Expdp/impdp Oracle 10g引入了D ...

  5. Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(上)

    <Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(上)> <Oracle简单常用的数据泵导出导入(expdp/impdp)命令举例(下)> 目的:指导项 ...

  6. PostgreSQL数据的导出导入

    PostgreSQL数据的导出导入 导出PostgreSQL数据库中的数据: $ pg_dump -U postgres  -f mydatabase.sql  mydatabase 导入数据时首先创 ...

  7. PostgreSQL数据的导出导入 save your data!

    PostgreSQL数据的导出导入 导出PostgreSQL数据库中的数据: $ pg_dump -U postgres  -f mydatabase.sql  mydatabase 导入数据时首先创 ...

  8. TP5.0 PHPExcel 数据表格导出导入(引)

    TP5.0 PHPExcel 数据表格导出导入(引) 今天看的是PHPExcel这个扩展库,Comporse 下载不下来,最后只能自己去github里面手动下载,但有一个问题就是下载下来的PHPExc ...

  9. linux mysql 数据库操作导入导出 数据表导出导入

    linux mysql 数据库操作导入导出 数据表导出导入 1,数据库导入 mysql -uroot -p show databases; create database newdb; use 数据库 ...

  10. mongodb 备份 还原 导出 导入

    张映 发表于 2013-12-03 分类目录: nosql 标签:mongodb, 备份, 导入, 导出, 还原 mongodb数据备份和还原主要分为二种,一种是针对于库的mongodump和mong ...

随机推荐

  1. 【python基础】类-类属性

    在初始类中,我们介绍了如何访问类属性,除了访问类属性外还有其他操作类属性的情况,我们将在这里做详细介绍: 1.给类属性指定默认值 类中的每个属性都必须有初始值,哪怕这个值是0或者空字符串.在有些情况下 ...

  2. 深入了解ApacheZeppelin:如何构建高效的数据科学平台

    目录 引言 随着数据科学和人工智能的快速发展,如何构建高效的数据科学平台已经成为一个重要议题.Apache Zeppelin是一个开源的数据科学平台,其提供了一种简单.高效的方式来处理和存储数据,并且 ...

  3. 用写代码的方式画图-试下PlantUML吧

    1 序言 所谓一图胜千言,大家平日在工作中编写文档时,往往都需要画各种图来表达中心思想,比如流程图.时序图.UML 图,很多人选择使用 Axure .PrecessOn.Diagrams(darw.i ...

  4. 2023-07-10:Kafka如何做到消息不丢失?

    2023-07-10:Kafka如何做到消息不丢失? 答案2023-07-10: Kafka采用多种机制来确保消息的不丢失,其中包括副本机制.ISR(In-Sync Replicas)机制以及ACK机 ...

  5. 【WebRtc】获取媒体设备信息

    加载设备信息页面 加载完设备信息页面 Code /** * 加载当前设备的音视频信息 */ initInnerLocalDevice() { let that = this; // 判断是否支持 if ...

  6. Hexo博客yilia主题文章添加目录

    参考文章 添加目录的文章有一些是自己添加css文件和修主题配置 作者也更新了文章大体目录的功能 打开配置文件themes/yilia/_config.yml 你可以选择toc设置为1 或者2 toc: ...

  7. matlab的gui图像处理操作界面,实现重置和退出按钮功能

    axes控件实现了展示图片,动态txt控件实现了展示或者输入参数. 重置 在gui界面右键点击重置pushbotton回到代码块callback,编写代码 以下代码是实现图片和参数数字重置,是重置按钮 ...

  8. Mysql获取时间戳的一些处理

    前情提要: 老板需要一个统计今日新增用户的功能 我的想法是统计24小时内新增用户的功能 直接去问AI 我明确指出了时间戳 但是AI给出的答案却差了口气 这就是老板给我工资而不是给微软工资的地方 DAT ...

  9. Blazor前后端框架Known-V1.2.5

    V1.2.5 Known是基于C#和Blazor开发的前后端分离快速开发框架,开箱即用,跨平台,一处代码,多处运行. Gitee: https://gitee.com/known/Known Gith ...

  10. VSCode:缩进两格空格

    在设定中对如图所示两项进行修改: 至此问题解决.