0
votes

When i faced his error i deleted mongod.lock from /var/lib/mongodb then i did mongod -repair SO it listed all these things

Fri Mar 21 14:21:17.511 [initandlisten] MongoDB starting : pid=21182 port=27017 dbpath=/data/db/ 64-bit host=thara-Precision-T1600
Fri Mar 21 14:21:17.511 [initandlisten] db version v2.4.9
Fri Mar 21 14:21:17.511 [initandlisten] git version: 52fe0d21959e32a5bdbecdc62057db386e4e029c
Fri Mar 21 14:21:17.511 [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
Fri Mar 21 14:21:17.511 [initandlisten] allocator: tcmalloc
Fri Mar 21 14:21:17.511 [initandlisten] options: { repair: true }
Fri Mar 21 14:21:17.511 [initandlisten] exception in initAndListen: 10296 
*********************************************************************
 ERROR: dbpath (/data/db/) does not exist.
 Create this directory or give existing directory in --dbpath.
 See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
Fri Mar 21 14:21:17.511 dbexit: 
Fri Mar 21 14:21:17.511 [initandlisten] shutdown: going to close listening sockets...
Fri Mar 21 14:21:17.511 [initandlisten] shutdown: going to flush diaglog...
Fri Mar 21 14:21:17.511 [initandlisten] shutdown: going to close sockets...
Fri Mar 21 14:21:17.511 [initandlisten] shutdown: waiting for fs preallocator...
Fri Mar 21 14:21:17.511 [initandlisten] shutdown: closing all files...
Fri Mar 21 14:21:17.511 [initandlisten] closeAllFiles() finished
Fri Mar 21 14:21:17.511 dbexit: really exiting now

Still it says pymongo.errors.ConnectionFailure: could not connect to localhost:27017: [Errno 111] Connection refused

1

1 Answers

4
votes

Like it says in the error message, mongod is not able to find the db path. Either create the folder "/data/db" at the root or if you have created it else where, specify the path using the --dbpath option like:

mongod --dbpath /data/db