Mongodb connection problem


#1

I’m relatively new to databases and i tried mongodb and it stated fine with no problems but now it can’t connect to the database and

2018-08-07T17:06:27.589+0000 [initandlisten] MongoDB starting : pid=2677 port=27017 dbpath=/data/db 64-bit host=mostafagamal123-blog-app-6299865
2018-08-07T17:06:27.589+0000 [initandlisten] db version v2.6.12
2018-08-07T17:06:27.589+0000 [initandlisten] git version: d73c92b1c85703828b55c2916a5dd4ad46535f6a
2018-08-07T17:06:27.589+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
2018-08-07T17:06:27.589+0000 [initandlisten] allocator: tcmalloc
2018-08-07T17:06:27.589+0000 [initandlisten] options: { repair: true }


You specified --repair but there are dirty journal files. Please
restart without --repair to allow the journal files to be replayed.
If you wish to repair all databases, please shutdown cleanly and
run with --repair again.


2018-08-07T17:06:27.590+0000 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
2018-08-07T17:06:27.590+0000 [initandlisten] dbexit:
2018-08-07T17:06:27.590+0000 [initandlisten] shutdown: going to close listening sockets…
2018-08-07T17:06:27.590+0000 [initandlisten] shutdown: going to flush diaglog…
2018-08-07T17:06:27.590+0000 [initandlisten] shutdown: going to close sockets…
2018-08-07T17:06:27.590+0000 [initandlisten] shutdown: waiting for fs preallocator…
2018-08-07T17:06:27.590+0000 [initandlisten] shutdown: closing all files…
2018-08-07T17:06:27.590+0000 [initandlisten] closeAllFiles() finished
2018-08-07T17:06:27.590+0000 [initandlisten] dbexit: really exiting now

this message is after i ran ./mongod --repair and i tried every solution but nothing is working so please can any one help me with this problem and in recovering my lost database


#2

Did you try the following?
killall mongod ; cd ; ./mongod --repair ; cd data ; rm -rf mongod.lock ; cd ; ./mongod