2

我填充 MongoDB 集合的速度比我意识到的要快,并且基本上用完了磁盘空间,但我认为我不干净地退出了它。我尝试使用 Homebrew 重新安装 MongoDB,但我遇到了以下一堆错误,并且不知道如何解决问题。

Fri Oct 19 20:40:20 [initandlisten] MongoDB starting : pid=12791 port=27017 

dbpath=/usr/local/var/mongodb 64-bit host=Evan-Zamirs-MacBook-Air.local
Fri Oct 19 20:40:20 [initandlisten] 
Fri Oct 19 20:40:20 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Fri Oct 19 20:40:20 [initandlisten] db version v2.2.0, pdfile version 4.5
Fri Oct 19 20:40:20 [initandlisten] git version: f5e83eae9cfbec7fb7a071321928f00d1b0c5207
Fri Oct 19 20:40:20 [initandlisten] build info: Darwin bs-osx-106-x86-64-1.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_49
Fri Oct 19 20:40:20 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/usr/local/etc/mongod.conf", dbpath: "/usr/local/var/mongodb" }
Fri Oct 19 20:40:20 [initandlisten] journal dir=/usr/local/var/mongodb/journal
Fri Oct 19 20:40:20 [initandlisten] recover : no journal files present, no recovery needed
Fri Oct 19 20:40:20 [initandlisten]  test.system.namespaces Assertion failure isOk() src/mongo/db/pdfile.h 360
0x10037637b 0x1000b0196 0x10029eb1b 0x1002a3838 0x10013056b 0x10056c80b 0x1005708f7 0x100570d75 0x1000828cb 0x100084f13 0x1006464c9 0x1006494d6 0x10064aec9 0x100175487 0x1001ac2df 0x10063efbf 0x100004ca6 0x100005815 0x10000608d 0x10000d534 
 0   mongod                              0x000000010037637b _ZN5mongo15printStackTraceERSo + 43
 1   mongod                              0x00000001000b0196 _ZN5mongo12verifyFailedEPKcS1_j + 310
 2   mongod                              0x000000010029eb1b _ZN5mongo11DataFileMgr7findAllEPKcRKNS_7DiskLocE + 1659
 3   mongod                              0x00000001002a3838 _ZN5mongo13findTableScanEPKcRKNS_7BSONObjERKNS_7DiskLocE + 312
 4   mongod                              0x000000010013056b _ZNK5mongo9QueryPlan9newCursorERKNS_7DiskLocE + 603
 5   mongod                              0x000000010056c80b _ZN5mongo15CursorGenerator16singlePlanCursorEv + 443
 6   mongod                              0x00000001005708f7 _ZN5mongo15CursorGenerator8generateEv + 199
 7   mongod                              0x0000000100570d75 _ZN5mongo25NamespaceDetailsTransient9getCursorEPKcRKNS_7BSONObjES5_RKNS_24QueryPlanSelectionPolicyEPbRKN5boost10shared_ptrIKNS_11ParsedQueryEEEbPNS_16QueryPlanSummaryE + 69
 8   mongod                              0x00000001000828cb _ZN5mongo23queryWithQueryOptimizerEiRKSsRKNS_7BSONObjERNS_5CurOpES4_S4_RKN5boost10shared_ptrINS_11ParsedQueryEEES4_RKNS_17ShardChunkVersionERNS7_10scoped_ptrINS_25PageFaultRetryableSectionEEERNSG_INS_19NoPageFaultsAllowedEEERNS_7MessageE + 363
 9   mongod                              0x0000000100084f13 _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 3187
 10  mongod                              0x00000001006464c9 _ZN5mongoL13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 393
 11  mongod                              0x00000001006494d6 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 950
 12  mongod                              0x000000010064aec9 _ZN5mongo14DBDirectClient4callERNS_7MessageES2_bPSs + 121
 13  mongod                              0x0000000100175487 _ZN5mongo14DBClientCursor4initEv + 167
 14  mongod                              0x00000001001ac2df _ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 191
 15  mongod                              0x000000010063efbf _ZN5mongo14DBDirectClient5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 79
 16  mongod                              0x0000000100004ca6 _ZN5mongo19clearTmpCollectionsEv + 710
 17  mongod                              0x0000000100005815 _ZN5mongo14_initAndListenEi + 1093
 18  mongod                              0x000000010000608d _ZN5mongo13initAndListenEi + 29
 19  mongod                              0x000000010000d534 _ZL11mongoDbMainiPPc + 29348
Fri Oct 19 20:40:20 [initandlisten] assertion 0 assertion src/mongo/db/pdfile.h:360 ns:test.system.namespaces query:{ options.temp: { $in: [ true, 1 ] } }
Fri Oct 19 20:40:20 [initandlisten] problem detected during query over test.system.namespaces : { $err: "assertion src/mongo/db/pdfile.h:360" }
Fri Oct 19 20:40:20 [initandlisten]  tutorial.system.namespaces Assertion failure isOk() src/mongo/db/pdfile.h 360
0x10037637b 0x1000b0196 0x10029eb1b 0x1002a3838 0x10013056b 0x10056c80b 0x1005708f7 0x100570d75 0x1000828cb 0x100084f13 0x1006464c9 0x1006494d6 0x10064aec9 0x100175487 0x1001ac2df 0x10063efbf 0x100004ca6 0x100005815 0x10000608d 0x10000d534 
0x10037637b 0x1000b0196 0x10029eb1b 0x1002a3838 0x10013056b 0x10056c80b 0x1005708f7 

0x100570d75 0x1000828cb 0x100084f13 0x1006464c9 0x1006494d6 0x10064aec9 0x100175487 0x1001ac2df 0x10063efbf 0x100004ca6 0x100005815 0x10000608d 0x10000d534 
 0   mongod                              0x000000010037637b _ZN5mongo15printStackTraceERSo + 43
 1   mongod                              0x00000001000b0196 _ZN5mongo12verifyFailedEPKcS1_j + 310
 2   mongod                              0x000000010029eb1b _ZN5mongo11DataFileMgr7findAllEPKcRKNS_7DiskLocE + 1659
 3   mongod                              0x00000001002a3838 _ZN5mongo13findTableScanEPKcRKNS_7BSONObjERKNS_7DiskLocE + 312
 4   mongod                              0x000000010013056b _ZNK5mongo9QueryPlan9newCursorERKNS_7DiskLocE + 603
 5   mongod                              0x000000010056c80b _ZN5mongo15CursorGenerator16singlePlanCursorEv + 443
 6   mongod                              0x00000001005708f7 _ZN5mongo15CursorGenerator8generateEv + 199
 7   mongod                              0x0000000100570d75 _ZN5mongo25NamespaceDetailsTransient9getCursorEPKcRKNS_7BSONObjES5_RKNS_24QueryPlanSelectionPolicyEPbRKN5boost10shared_ptrIKNS_11ParsedQueryEEEbPNS_16QueryPlanSummaryE + 69
 8   mongod                              0x00000001000828cb _ZN5mongo23queryWithQueryOptimizerEiRKSsRKNS_7BSONObjERNS_5CurOpES4_S4_RKN5boost10shared_ptrINS_11ParsedQueryEEES4_RKNS_17ShardChunkVersionERNS7_10scoped_ptrINS_25PageFaultRetryableSectionEEERNSG_INS_19NoPageFaultsAllowedEEERNS_7MessageE + 363
 9   mongod                              0x0000000100084f13 _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 3187
 10  mongod                              0x00000001006464c9 _ZN5mongoL13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 393
 11  mongod                              0x00000001006494d6 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 950
 12  mongod                              0x000000010064aec9 _ZN5mongo14DBDirectClient4callERNS_7MessageES2_bPSs + 121
 13  mongod                              0x0000000100175487 _ZN5mongo14DBClientCursor4initEv + 167
 14  mongod                              0x00000001001ac2df _ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 191
 15  mongod                              0x000000010063efbf _ZN5mongo14DBDirectClient5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 79
 16  mongod                              0x0000000100004ca6 _ZN5mongo19clearTmpCollectionsEv + 710
 17  mongod                              0x0000000100005815 _ZN5mongo14_initAndListenEi + 1093
 18  mongod                              0x000000010000608d _ZN5mongo13initAndListenEi + 29
 19  mongod                              0x000000010000d534 _ZL11mongoDbMainiPPc + 29348
Fri Oct 19 20:40:20 [initandlisten] assertion 0 assertion src/mongo/db/pdfile.h:360 ns:tutorial.system.namespaces query:{ options.temp: { $in: [ true, 1 ] } }
Fri Oct 19 20:40:20 [initandlisten] problem detected during query over tutorial.system.namespaces : { $err: "assertion src/mongo/db/pdfile.h:360" }
Fri Oct 19 20:40:20 [initandlisten] Dropping old temporary collection: 
Fri Oct 19 20:40:20 [initandlisten] exception in initAndListen: 10011 no collection name, terminating
Fri Oct 19 20:40:20 dbexit: 
Fri Oct 19 20:40:20 [initandlisten] shutdown: going to close listening sockets...
Fri Oct 19 20:40:20 [initandlisten] shutdown: going to flush diaglog...
Fri Oct 19 20:40:20 [initandlisten] shutdown: going to close sockets...
Fri Oct 19 20:40:20 [initandlisten] shutdown: waiting for fs preallocator...
Fri Oct 19 20:40:20 [initandlisten] shutdown: lock for final commit...
Fri Oct 19 20:40:20 [initandlisten] shutdown: final commit...
Fri Oct 19 20:40:20 [initandlisten] shutdown: closing all files...
Fri Oct 19 20:40:20 [initandlisten] closeAllFiles() finished
Fri Oct 19 20:40:20 [initandlisten] journalCleanup...
Fri Oct 19 20:40:20 [initandlisten] removeJournalFiles
Fri Oct 19 20:40:20 [initandlisten] shutdown: removing fs lock...
Fri Oct 19 20:40:20 dbexit: really exiting now
4

2 回答 2

3

您不需要重新安装 mongoDB。您可以按照 Stennie 给出的步骤进行修复

或者

您可以删除 data/db 或您的数据目录所在的任何位置,然后再次创建具有相同名称 data/db 的新文件夹。之后转到数据文件夹所在的目录并使用 mongod 命令启动 mongo 服务器。

但是您会丢失数据,但这是一种快速重启的方法。

于 2013-07-26T14:47:07.020 回答
2

看起来您有一些数据库损坏,需要repair在您的数据库上运行。修复过程实质上是重建数据库并跳过可疑数据。它将暂时需要足够的空间来存储数据库的额外副本(或者至少是可以复制的“好”数据),因此如果磁盘空间仍然不足,这可能不是一个选择。

您可以使用以下方法修复所有数据库:

`mongod --repair`

如果您安装了另一个具有更多空间的驱动器,则可以传递一个--repairpath参数,以便修复对修复期间创建的临时文件使用不同的路径。

如果mongod在启动时没有崩溃,您还可以选择mongo使用 db 并调用以下命令从 shell 中对单个数据库运行修复:

db.repairDatabase()

像您一样重新安装 MongoDB 不会修复数据文件中的任何问题。如果您不关心数据(例如,上面引用的日志摘录testtutorial)..您也可以删除数据目录并重新开始。看起来您的数据目录将是:/usr/local/var/mongodb.

于 2012-10-20T11:56:30.720 回答