MongoDB非正常关闭后修复记录

MongoDB非正常关闭后修复记录

mongod没有后台执行,在终端连接非正常断开后,再次执行mongod报错,如下所示:

[root@sunrise16 bin]# ./mongod
./mongod --help for help and startup options
Tue Oct 25 19:49:02
Tue Oct 25 19:49:02 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Tue Oct 25 19:49:02
Tue Oct 25 19:49:02 [initandlisten] MongoDB starting : pid=13626 port=27017 dbpath=/data/db/ 32-bit host=sunrise16
Tue Oct 25 19:49:02 [initandlisten]
Tue Oct 25 19:49:02 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Tue Oct 25 19:49:02 [initandlisten] **       see http://blog.mongodb.org/post/137788967/32-bit-limitations
Tue Oct 25 19:49:02 [initandlisten] **       with --journal, the limit is lower
Tue Oct 25 19:49:02 [initandlisten]
Tue Oct 25 19:49:02 [initandlisten] db version v2.0.0, pdfile version 4.5
Tue Oct 25 19:49:02 [initandlisten] git version: 695c67dff0ffc361b8568a13366f027caa406222
Tue Oct 25 19:49:02 [initandlisten] build info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37
Tue Oct 25 19:49:02 [initandlisten] options: {}
**************
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
Tue Oct 25 19:49:02 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
Tue Oct 25 19:49:02 dbexit:
Tue Oct 25 19:49:02 [initandlisten] shutdown: going to close listening sockets...
Tue Oct 25 19:49:02 [initandlisten] shutdown: going to flush diaglog...
Tue Oct 25 19:49:02 [initandlisten] shutdown: going to close sockets...
Tue Oct 25 19:49:02 [initandlisten] shutdown: waiting for fs preallocator...
Tue Oct 25 19:49:02 [initandlisten] shutdown: closing all files...
Tue Oct 25 19:49:02 [initandlisten] closeAllFiles() finished
Tue Oct 25 19:49:02 dbexit: really exiting now

 

http://www.mongodb.org/display/DOCS/Durability+and+Repair#DurabilityandRepair-RepairCommand 写道
Repair Command

When not using journaling (--nojournal), after a machine crash or kill -9 termination, run the repairDatabase command. This command will check all data for corruption, remove any corruption found, and compact data files a bit. Repair is analogous to running fsck for a file system.

When journaling is enabled, it should not be necessary to run repair. However one could still use the repair command to compact a database.

From the command line:

mongod --repair

From the shell (you have to do for all dbs including local if you go this route):

> db.repairDatabase();

During a repair operation, mongod must store temporary files to disk. By default, mongod creates temporary directories under the dbpath for this purpose. Alternatively, the --repairpath command line option can be used to specify a base directory for temporary repair files.

Note that repair is a slow operation which inspects the entire database.

After running with --repair, mongod will start up normally.
 

现在执行修复。
[root@sunrise16 bin]# ./mongod --repair
Tue Oct 25 19:50:21
Tue Oct 25 19:50:21 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Tue Oct 25 19:50:21
Tue Oct 25 19:50:21 [initandlisten] MongoDB starting : pid=14452 port=27017 dbpath=/data/db/ 32-bit host=sunrise16
Tue Oct 25 19:50:21 [initandlisten]
Tue Oct 25 19:50:21 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Tue Oct 25 19:50:21 [initandlisten] **       see http://blog.mongodb.org/post/137788967/32-bit-limitations
Tue Oct 25 19:50:21 [initandlisten] **       with --journal, the limit is lower
Tue Oct 25 19:50:21 [initandlisten]
Tue Oct 25 19:50:21 [initandlisten] db version v2.0.0, pdfile version 4.5
Tue Oct 25 19:50:21 [initandlisten] git version: 695c67dff0ffc361b8568a13366f027caa406222
Tue Oct 25 19:50:21 [initandlisten] build info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37
Tue Oct 25 19:50:21 [initandlisten] options: { repair: true }
Tue Oct 25 19:50:22 [initandlisten] ****
Tue Oct 25 19:50:22 [initandlisten] ****
Tue Oct 25 19:50:22 [initandlisten] need to upgrade database mydb with pdfile version 4.5, new version: 4.5
Tue Oct 25 19:50:22 [initandlisten]      starting upgrade
Tue Oct 25 19:50:22 [initandlisten]  mydb repairDatabase mydb
Tue Oct 25 19:50:22 [FileAllocator] allocating new datafile /data/db/$tmp_repairDatabase_0/mydb.ns, filling with zeroes...
Tue Oct 25 19:50:22 [FileAllocator] creating directory /data/db/$tmp_repairDatabase_0/_tmp
Tue Oct 25 19:50:26 [FileAllocator] done allocating datafile /data/db/$tmp_repairDatabase_0/mydb.ns, size: 16MB,  took 4 secs
Tue Oct 25 19:50:26 [FileAllocator] allocating new datafile /data/db/$tmp_repairDatabase_0/mydb.0, filling with zeroes...
Tue Oct 25 19:50:30 [FileAllocator] done allocating datafile /data/db/$tmp_repairDatabase_0/mydb.0, size: 16MB,  took 4.004 secs
Tue Oct 25 19:50:30 [FileAllocator] allocating new datafile /data/db/$tmp_repairDatabase_0/mydb.1, filling with zeroes...
Tue Oct 25 19:50:30 [initandlisten] build index mydb.things { _id: 1 }
Tue Oct 25 19:50:30 [initandlisten] build index done 22 records 0.008 secs
Tue Oct 25 19:50:38 [FileAllocator] done allocating datafile /data/db/$tmp_repairDatabase_0/mydb.1, size: 32MB,  took 7.981 secs
Tue Oct 25 19:50:38 [initandlisten] ****
Tue Oct 25 19:50:38 [initandlisten] ****
Tue Oct 25 19:50:38 [initandlisten] need to upgrade database test with pdfile version 4.5, new version: 4.5
Tue Oct 25 19:50:38 [initandlisten]      starting upgrade
Tue Oct 25 19:50:38 [initandlisten]  test repairDatabase test
Tue Oct 25 19:50:38 [FileAllocator] allocating new datafile /data/db/$tmp_repairDatabase_0/test.ns, filling with zeroes...
Tue Oct 25 19:50:38 [FileAllocator] creating directory /data/db/$tmp_repairDatabase_0/_tmp
Tue Oct 25 19:50:42 [FileAllocator] done allocating datafile /data/db/$tmp_repairDatabase_0/test.ns, size: 16MB,  took 3.995 secs
Tue Oct 25 19:50:42 [FileAllocator] allocating new datafile /data/db/$tmp_repairDatabase_0/test.0, filling with zeroes...
Tue Oct 25 19:50:46 [FileAllocator] done allocating datafile /data/db/$tmp_repairDatabase_0/test.0, size: 16MB,  took 4.06 secs
Tue Oct 25 19:50:46 [FileAllocator] allocating new datafile /data/db/$tmp_repairDatabase_0/test.1, filling with zeroes...
Tue Oct 25 19:50:46 [initandlisten] build index test.foo { _id: 1 }
Tue Oct 25 19:50:46 [initandlisten] build index done 1 records 0 secs
Tue Oct 25 19:50:54 [FileAllocator] done allocating datafile /data/db/$tmp_repairDatabase_0/test.1, size: 32MB,  took 8.031 secs
Tue Oct 25 19:50:54 [initandlisten] finished checking dbs
Tue Oct 25 19:50:54 dbexit:
Tue Oct 25 19:50:54 [initandlisten] shutdown: going to close listening sockets...
Tue Oct 25 19:50:54 [initandlisten] shutdown: going to flush diaglog...
Tue Oct 25 19:50:54 [initandlisten] shutdown: going to close sockets...
Tue Oct 25 19:50:54 [initandlisten] shutdown: waiting for fs preallocator...
Tue Oct 25 19:50:54 [initandlisten] shutdown: closing all files...
Tue Oct 25 19:50:54 [initandlisten] closeAllFiles() finished
Tue Oct 25 19:50:54 [initandlisten] shutdown: removing fs lock...
Tue Oct 25 19:50:54 dbexit: really exiting now

 

现在正常启动mongod。
[root@sunrise16 bin]# ./mongod
./mongod --help for help and startup options
Tue Oct 25 19:51:00
Tue Oct 25 19:51:00 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Tue Oct 25 19:51:00
Tue Oct 25 19:51:00 [initandlisten] MongoDB starting : pid=14459 port=27017 dbpath=/data/db/ 32-bit host=sunrise16
Tue Oct 25 19:51:00 [initandlisten]
Tue Oct 25 19:51:00 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Tue Oct 25 19:51:00 [initandlisten] **       see http://blog.mongodb.org/post/137788967/32-bit-limitations
Tue Oct 25 19:51:00 [initandlisten] **       with --journal, the limit is lower
Tue Oct 25 19:51:00 [initandlisten]
Tue Oct 25 19:51:00 [initandlisten] db version v2.0.0, pdfile version 4.5
Tue Oct 25 19:51:00 [initandlisten] git version: 695c67dff0ffc361b8568a13366f027caa406222
Tue Oct 25 19:51:00 [initandlisten] build info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37
Tue Oct 25 19:51:00 [initandlisten] options: {}
Tue Oct 25 19:51:00 [initandlisten] waiting for connections on port 27017
Tue Oct 25 19:51:00 [websvr] admin web console waiting for connections on port 28017

Tue Oct 25 19:52:00 [clientcursormon] mem (MB) res:12 virt:92 mapped:0
Tue Oct 25 19:57:00 [clientcursormon] mem (MB) res:12 virt:92 mapped:0

 

...

 

 

 

MPU6050芯片 寄存器详解与配置指南(详解) 分频值越小,数据刷新越快(如分频值 = 0 时,刷新率 = 8kHz/1=8kHz)。功能:配置采样频率分频系数,控制 ADC 转换速度和数据刷新率。数据刷新率 = 陀螺仪输出时钟频率 /(1 + 分频值) 阅读详情

相关推荐

Claude Skills 深度讲解

阶段 1:Function Call(2023)├─ 大模型可以调用外部工具├─ 问题:缺乏对任务的深度理解└─ 局限:工具调用简单线性阶段 2:MCP 上下文工程(2024)├─ 大模型有了更丰富的上下文和工具├─ 问题:仍然需要手动编写复杂的 Prompt└─ 局限:每次对话都需要重新加载上下文阶段 3:Claude Skills(2025)├─ 大模型有了「能力模块」的概念├─ 可以动态加载、组合、执行专门的工作流├─ 真正实现了「知识的模块化和复用」

u013134676的博客 1475

【MongDB】非正常关闭导致的不能启动的解决方法

mongdb 非正常关闭导致的不能启动的解决方法 服务器断电、异常关闭以及直接killall命令导致服务终止的情况都可能会被mondodb认为是unclean shutdown, 因为unclean shutdown可能会导致数据不一致性或者数据损坏,所以必须要手动修复后才能继续提供服务。 mongodb修复unclean shutdown的方式有: 1、从journal修复,journa...

我其实发现我还是适合当厨师 902

Multisim14安装失败?手把手教你彻底清理残留文件(附专用卸载工具)

本文针对Multisim14安装失败问题,提供了一套从根源解决的完整方案。文章详细分析了安装失败的三大元凶——文件残留、注册表残留和隐藏组件,并手把手指导用户使用专用卸载工具进行标准化清理,再结合手动深度清理文件系统和注册表,最终实现彻底卸载和完美重装,有效解决Multisim14安装问题。

weixin_29179311的博客 322

启动mongodb遇到的错:warning: 32-bit servers don't have journaling enabled by deflity

执行修复:mongod --repair即可 正常关闭:killall mongod 转载于:https://www.cnblogs.com/fun0623/p/4694049.html

weixin_30757793的博客 347

解决若依Vue3前后端分离---路由切换时显示白屏

解决基于Vue3若依前后端分离项目中出现的路由正常切换但是就是不显示数据的问题,也就是不发起网络请求的问题。

简单点的博客 1611

一文带你弄懂thermal governor IPA

当current temp < target temp时,使用k_pu,当current temp >= target temp时,使用k_po。如果current_temperature = switch_on_temp时,则k_p = k_pu,这时Pmax。如果current_temperature = target_temp时,则k_p = k_po,这时Pmax。2、解析dts,获得switch_on_temp和target_temp。3、初始化k_pu/k_po/k_i/k_d的常数。

yxw0609131056的博客 1256

mongoDB非正常关闭后无法启动问题

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34248023的博客 414

三电平逆变器LC滤波设计避坑指南:从SVPWM谐波到Simulink仿真验证

本文详细解析了三电平逆变器LC滤波设计中的关键问题,从SVPWM谐波特性到Simulink仿真验证,提供了800V/10kW系统的参数计算方法和优化技巧。通过实际案例和仿真配置示例,帮助工程师避免常见设计误区,提升电能质量和系统稳定性。

weixin_29261711的博客 177

修复MongoDB数据库,解决因Unclean Shutdown导致服务不能启动的问题

今天原本想研究点mongodb的东西,发现服务启不来了: [root@biao ~]# mongod -f /etc/mongod.conf forked process: 19465 all output going to: /mongodb/log/mongodb.log [root@biao ~]# service mongod status m

千古悠悠何所愁的专栏 1万+

20_文件系统的制作 -JFFS2

JFFS2 文件系统是通过工具 mkfs.jffs2 将文件系统目录制成映像文件。制作工具mkfs.jffs2 需要编译 zhb 库和 mtd-utils,下面详细介绍其制作过程

Leon的博客 552

YOLO11实战优化:暗光环境检测 | 引入Retinex增强模块与YOLO11联合训练,解决夜间/低照度场景抓拍痛点

本文探讨了暗光环境下目标检测的技术挑战与解决方案。研究发现,传统CNN模型在低照度条件下性能显著下降,主要由于光子数减少导致信噪比降低、目标特征被噪声淹没。针对这一问题,文章提出将可微分光照增强模块嵌入YOLO检测器的技术路线,重点分析了Retinexformer+YOLO11联合方案的优势。 文章对比了YOLO系列模型在暗光场景的表现,指出YOLO11凭借其C3k2模块、无锚检测头和多任务统一骨干网络,在低对比度图像特征提取方面优于前代产品。同时详细介绍了Retinexformer的理论基础和技术创新,包

2601_95807009的博客 213

MongoDB非正常关闭后修复记录 mongod --repair

mongod没有后台执行,在终端连接非正常断开后,再次执行mongod报错,如下所示: [root@localhost mongodb]# ./bin/mongod./bin/mongod --help for help ...

ciyoumie0113的博客 1906

git clone出现fatal: unable to access Failed to connect to github.com port 443: Timed out解决方案

本文主要介绍了git clone出现fatal: unable to access Failed to connect to github.com port 443: Timed out解决方案,希望能对使用git的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 23万+

mongodb的环境搭建

MongoDB是非关系类型的数据库,

寄情于码 786

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

【MangoDB】mongodb异常关闭后,再启动需要删除mongod.lock文件

mongod.lock文件是mongo服务端启动后在硬盘中创建的一个锁文件, 如果你正常退出mongod服务,该文件即使还存在,也不会影响下一次启动mongod服务的。 这个文件还会记录mongod在运行过程中的一些状态,以便在正常重新启动服务时能够获取异常信息提示。 非正常关闭了mongoDB,重启错误信息如下:  01 Tue Apr 17 11:13:30  02 Tue Apr 17...

我其实发现我还是适合当厨师 6662

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

MongoDB-启动的时候出现了问题(转载)

之前MongoDB启动的时候是蛮正常的,不知道后来启动报错了,就把粘贴出来查询了。最后才知道是由于自己不正常的关闭导致的这个情况。 --摘录:MongoDB非正常关闭后修复记录   mongod没有后台执行,在终端连接非正常断开后,再次执行mongod报错,如下所示: [root@localhost mongodb]# ./bin/mongod ./bin/mongod --help f...

wb284551926的博客 343

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

Mongodb上一次非正常关闭后修复

rm -rf /data/mongodb/data/puf_sfap/mongod.lock rm -rf /data/mongodb/data/puf_sfap/WiredTiger.lock /data/mongodb/bin/mongod --repair -f /data/mongodb/config/mongod.conf -nojournal --repairpath /data/mo

gotobar的专栏 3829

MacOS 下MongoDB非正常关闭后无法启动,无法repair后,如何进行数据恢复的方法之一

MacOS 下 mongodb无法启动、MacOS 下mongodb无法repair的时候,MacOS 下mongodb数据恢复方法,MacOS 下mongodb灾难恢复

1974

MongoDb非正常关闭后重启遇到问题

/*********MongoDB重启遇到错误、 about to fork child process, waiting until server is ready for connections. forked process: 10117 ERROR: child process failed, exited with error number 48 To see additional in...

appcanLiYunLong的博客 2670

mongodb报错lockbusy_mongodb 中data lock解决方法

之前MongoDB启动的时候是蛮正常的,不知道后来启动报错了,就把粘贴出来查询了。最后才知道是由于自己不正常的关闭导致的这个情况。--摘录:MongoDB非正常关闭后修复记录mongod没有后台执行,在终端连接非正常断开后,再次执行mongod报错,如下所示:[root@localhost mongodb]# ./bin/mongod ./bin/mongod --help for help an...

weixin_39684228的博客 753

mongodb 客户端_MongoDb非正常关闭后重启

MongoDB重启遇到错误about to fork child process, waiting until server is ready for connections.forked process: 10117ERROR: child process failed, exited with error number 48To see additional information in th...

weixin_39905226的博客 521

mongodb启动出现问题解决方法。

之前MongoDB启动的时候是蛮正常的,不知道后来启动报错了,就把粘贴出来查询了。最后才知道是由于自己不正常的关闭导致的这个情况。 --摘录:MongoDB非正常关闭后修复记录   mongod没有后台执行,在终端连接非正常断开后,再次执行mongod报错,如下所示: [root@localhost mongodb]# ./bin/mongod ./bin/mongod --help for

CJaver的专栏 2261

journal 重启_MongoDb非正常关闭后重启

MongoDB重启遇到错误about to fork child process, waiting until server is ready for connections.forked process: 10117ERROR: child process failed, exited with error number 48To see additional information in th...

weixin_31479991的博客 219

Linux下MongoDB非正常关闭启动异常解决方法

1、将配置信息写入一个文件中 vim mongo.conf 里面写如下内容: dbpath=/usr/local/mongodb/data/ logpath=/usr/local/mongodb/logs/mongodb.log logappend=true port=27017 fork=true 2、启动mongod /usr/lo...

weixin_30814329的博客 1778
上一篇: Bash字符串处理(与Java对照) - 22.判断字符串是否数字串
下一篇: MongoDB下查询数组的尝试记录
codingstandards
博客等级 码龄16年 12粉丝 3原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值