S
S
Saer2017-06-17 01:58:30
MongoDB
Saer, 2017-06-17 01:58:30

How to restore MongoDB after Unclean shutdown detected?

Hello.
I must say right away that I am a beginner and understand programming in so far as, so I quietly and peacefully train on c9.io. I recently started studying MongoDB, and then the problem described in the title occurred - I did not stop the database, c9 automatically cut everything down (after a few hours of inactivity, the hosting is turned off) and Mongo is now not working.
I tried following the instructions from here: dochub.mongodb.org/core/repair, but this did not work.
I used both mongod --repair and mongod --dbpath /data/db --repair, this is what I get:

2017-06-16T22:56:00.659+0000 [initandlisten] MongoDB starting : pid=2828 port=27017 dbpath=/data/db 64-bit host=fortecs-testdev-4905931
2017-06-16T22:56:00.659+0000 [initandlisten] db version v2.6.12
2017-06-16T22:56:00.659+0000 [initandlisten] git version: d73c92b1c85703828b55c2916a5dd4ad46535f6a
2017-06-16T22:56:00.659.infoinny.buildlisten5 [initandlisten] 10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2017-06-16T22:56:00.659+0000 [initandlisten] allocator: tcmalloc
2017-
06-16T22 :56:
00.659 +0000 [initandlisten] options: { repair: true } dbexit:
2017-06-16T22 :56:
00.665 +0000 [initandlisten] shutdown: going to close listening sockets...
-16T22:56:00.665+0000 [initandlisten] shutdown: going to close sockets...
2017-06-16T22:56:00.665+0000 [initandlisten] shutdown: waiting for fs preallocator...
2017-06-16T22:56 :
00.665 +0000 [initandlisten] shutdown: closing all files...
fs lock...
2017-06-16T22:56:00.665+0000 [initandlisten] dbexit: really exiting now

When I try to run ./mongod I get:

2017-06-16T22:56:57.668+0000 ** WARNING: --rest is specified without --httpinterface,
2017-06-16T22:56:57.668+0000 ** enabling http interface
warning: bind_ip of 0.0.0.0 is unnecessary ; listens on all ips by default
2017-06-16T22:56:57.672+0000 [initandlisten] MongoDB starting : pid=2839 port=27017 dbpath=data 64-bit host=fortecs-testdev-4905931
2017-06-16T22:56: 57.672 + 0000 [initandlisten] db version v2.6.12
2017-06-16T22: 56: 57.672 + 0000 [initandlisten] git version: d73c92b1c85703828b55c2916a5dd4ad46535f6a
2017-06-16T22: 56: 57.672 + 0000 [initandlisten] build info: Linux build5.ny .cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2017-06-16T22:56:57.672+0000 [initandlisten] allocator:
tcmalloc true, enabled: true } }, storage: { dbPath: "data", journal: { enabled: false } } }
**************
Unclean shutdown detected.
Please visit dochub.mongodb.org/core/repair for recovery instructions.
*************
2017-06-16T22:56:57.804+0000 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
2017-06-16T22:56:57.804+0000 [initandlisten ] dbexit:
2017-06-16T22:56:57.804+0000 [initandlisten] shutdown: going to close listening sockets...
2017-06-16T22:56:57.804+0000 [initandlisten] shutdown: going to flush diaglog
...
16T22:56:57.804+0000 [initandlisten] shutdown: waiting for fs preallocator... 2017-06-16T22: 56
:57.804+0000 [initandlisten] shutdown: closing all files...
+0000 [initandlisten] closeAllFiles() finished
2017-06-16T22:56:57.804+0000 [initandlisten] dbexit: really exiting now

Please describe step by step what I need to do to restore performance.
Well, or how to completely remove MongoDB in order to reinstall it again, there is nothing important there ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
roadvirus, 2017-09-21
@roadvirus

rm -rf /data/db/mongod.lock
mongod --dbpath /data/db --repair
mongod --dbpath /data/db
after the first step MAKE SURE mongod.lock is removed, otherwise the success of the operation is not guaranteed :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question