2013-04-29 46 views
0

我啓動MongoDB,使用commang:sudo service mongodb start。 操作系統:Ubuntu的11.04 我的日誌是在這裏:斷言:13524:內存不足AlignedBuilder

***** SERVER RESTARTED ***** 


Mon Apr 29 21:55:23.697 [initandlisten] MongoDB starting : pid=3995 port=27017 dbpath=/srv/mongodb/ 64-bit host=myhost 
Mon Apr 29 21:55:23.697 [initandlisten] 
Mon Apr 29 21:55:23.697 [initandlisten] ** WARNING: You are running in OpenVZ. This is known to be broken!!! 
Mon Apr 29 21:55:23.697 [initandlisten] 
Mon Apr 29 21:55:23.697 [initandlisten] db version v2.4.3 
Mon Apr 29 21:55:23.697 [initandlisten] git version: fe1743177a5ea03e91e0052fb5e2cb2945f6d95f 
Mon Apr 29 21:55:23.697 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49 
Mon Apr 29 21:55:23.697 [initandlisten] allocator: tcmalloc 
Mon Apr 29 21:55:23.697 [initandlisten] options: { config: "/etc/mongodb.conf", dbpath: "/srv/mongodb/", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" } 
Mon Apr 29 21:55:23.701 [initandlisten] journal dir=/srv/mongodb/journal 
Mon Apr 29 21:55:23.706 [initandlisten] recover : no journal files present, no recovery needed 
Mon Apr 29 21:55:24.465 [initandlisten] preallocateIsFaster=true 14.5 
Mon Apr 29 21:55:26.100 [initandlisten] preallocateIsFaster=true 32.4 
Mon Apr 29 21:55:27.419 [initandlisten] preallocateIsFaster=true 6.1 
Mon Apr 29 21:55:27.419 [initandlisten] preallocateIsFaster check took 3.71 secs 
Mon Apr 29 21:55:27.419 [initandlisten] preallocating a journal file /srv/mongodb/journal/prealloc.0 
Mon Apr 29 21:55:30.011 [initandlisten]   File Preallocator Progress: 377487360/1073741824 35% 
Mon Apr 29 21:55:48.672 [initandlisten] preallocating a journal file /srv/mongodb/journal/prealloc.1 
Mon Apr 29 21:55:51.008 [initandlisten]   File Preallocator Progress: 283115520/1073741824 26% 
Mon Apr 29 21:55:54.032 [initandlisten]   File Preallocator Progress: 754974720/1073741824 70% 
Mon Apr 29 21:56:12.230 [initandlisten] preallocating a journal file /srv/mongodb/journal/prealloc.2 
Mon Apr 29 21:56:15.006 [initandlisten]   File Preallocator Progress: 765460480/1073741824 71% 
Mon Apr 29 21:56:37.587 [FileAllocator] allocating new datafile /srv/mongodb/local.ns, filling with zeroes... 
Mon Apr 29 21:56:37.587 [FileAllocator] creating directory /srv/mongodb/_tmp 
Mon Apr 29 21:56:39.362 [FileAllocator] done allocating datafile /srv/mongodb/local.ns, size: 16MB, took 1.19 secs 
Mon Apr 29 21:56:39.362 [FileAllocator] allocating new datafile /srv/mongodb/local.0, filling with zeroes... 
Mon Apr 29 21:56:43.413 [FileAllocator] done allocating datafile /srv/mongodb/local.0, size: 64MB, took 4.051 secs 
Mon Apr 29 21:56:43.426 [initandlisten] command local.$cmd command: { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 reslen:37 5839ms 
Mon Apr 29 21:56:43.426 [initandlisten] waiting for connections on port 27017 
Mon Apr 29 21:56:43.426 [journal] Assertion: 13524:out of memory AlignedBuilder 
Mon Apr 29 21:56:43.426 [websvr] admin web console waiting for connections on port 28017 
0xdcf361 0xd90a1b 0xd8e9ec 0xd8ec80 0x924cd1 0x924ec2 0x91a0b1 0x91bcf9 0x91c0bb 0xe17cb9 0x2ab868e0bd8c 0x2ab869ab6fdd 
/usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0xdcf361] 
/usr/bin/mongod(_ZN5mongo11msgassertedEiPKc+0x9b) [0xd90a1b] 
/usr/bin/mongod() [0xd8e9ec] 
/usr/bin/mongod(_ZN5mongo14AlignedBuilderC1Ej+0x10) [0xd8ec80] 
/usr/bin/mongod(_ZN5mongo3dur7Journal7journalERKNS0_11JSectHeaderERKNS_14AlignedBuilderE+0x221) [0x924cd1] 
/usr/bin/mongod(_ZN5mongo3dur14WRITETOJOURNALENS0_11JSectHeaderERNS_14AlignedBuilderE+0x32) [0x924ec2] 
/usr/bin/mongod(_ZN5mongo3dur27groupCommitWithLimitedLocksEv+0x141) [0x91a0b1] 
/usr/bin/mongod() [0x91bcf9] 
/usr/bin/mongod(_ZN5mongo3dur9durThreadEv+0x2eb) [0x91c0bb] 
/usr/bin/mongod() [0xe17cb9] 
/lib/x86_64-linux-gnu/libpthread.so.0(+0x6d8c) [0x2ab868e0bd8c] 
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x2ab869ab6fdd] 
Mon Apr 29 21:56:43.880 [journal] dbexception in groupCommitLL causing immediate shutdown: 13524 out of memory AlignedBuilder 
Mon Apr 29 21:56:43.880 dur1 
Mon Apr 29 21:56:43.880 Got signal: 6 (Aborted). 

Mon Apr 29 21:56:43.882 Backtrace: 
0xdcf361 0x6cf729 0x2ab869a01d80 0x2ab869a01d05 0x2ab869a05ab6 0x9e8de7 0x91a4df 0x91bcf9 0x91c0bb 0xe17cb9 0x2ab868e0bd8c 0x2ab869ab6fdd 
/usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0xdcf361] 
/usr/bin/mongod(_ZN5mongo10abruptQuitEi+0x399) [0x6cf729] 
/lib/x86_64-linux-gnu/libc.so.6(+0x33d80) [0x2ab869a01d80] 
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35) [0x2ab869a01d05] 
/lib/x86_64-linux-gnu/libc.so.6(abort+0x186) [0x2ab869a05ab6] 
/usr/bin/mongod(_ZN5mongo10mongoAbortEPKc+0x47) [0x9e8de7] 
/usr/bin/mongod(_ZN5mongo3dur27groupCommitWithLimitedLocksEv+0x56f) [0x91a4df] 
/usr/bin/mongod() [0x91bcf9] 
/usr/bin/mongod(_ZN5mongo3dur9durThreadEv+0x2eb) [0x91c0bb] 
/usr/bin/mongod() [0xe17cb9] 
/lib/x86_64-linux-gnu/libpthread.so.0(+0x6d8c) [0x2ab868e0bd8c] 
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x2ab869ab6fdd] 

如何解決這個問題呢?我嘗試重新安裝MongoDB,但我的問題仍然存在。
PS:爲什麼dbpath目錄太大?

[email protected]:~# du -hs /srv/mongodb/ 
3.1G /srv/mongodb/ 

回答

1

您正在使用OpenVZ作爲您的VM管理程序。 OpenVZ管理內存的方式意味着MongoDB的內存映射文件結構將會不是的工作。

如果可能,您應該嘗試獲取使用KVM的虛擬機作爲其管理程序。

1

當文件系統進入100%(由於詳細日誌不在/ var中)時,我遇到了這個問題。 它結束了糟糕的日誌文件。 無法修復數據庫(即使使用--repair)

恢復的唯一方法似乎是從備份重新啓動,然後重新導入適當的表。 能夠在這種情況下重新啓動數據庫(對於mongodump或因爲它是prod)如下。

你必須開始蒙戈無日誌(很危險的,你應該離開這個模式ASAP)

set nojournal = true in mongod.conf then: rm /mnt/pathto/mongodb/journal/* rm /mnt/pathto/mongodb/mongod.lock chown -R mongodb:mongodb /mnt/pathto/mongodb (in case you tried as root "mongod -f /etc/mongodb.conf --repair" as I did) service mongodb start

DB高達&運行,你可以做你的轉儲重新啓動它的日誌(恢復後備份然後是mongodumps)