Enable shell logon for the first time after installing MongoDB
Mongo
The error will appear:
warning:failed to connect to 127.0.0.1:27017, reason:errno:111 Connection refused
Use the command to view the following related information:
Mongod–v
Output the following information:
2014-12-31t22:39:39.586-0800 shardkeytest passed 2014-12-31t22:39:39.587-0800 Isinrangetest passed 2014-12-31t22:39:39.587-0800 shardobjtest passed 2014-12-31t22:39:39.588-0800 [datafilesync] backgroundjob starting: DataFileSync 2014-12-31T22:39:39.604-0800 [initandlisten] MongoDB starting : pid=20666 port=27017 dbpath=/data/db 64-bit host= localhost.localdomain 2014-12-31t22:39:39.605-0800 [initandlisten] db version v2.6.6 2014-12-31t22:39:39.605-0800 [initandlisten] git version: 608e8bc319627693b04cc7da29ecc300a5f45a1f modules: enterprise 2014-12-31t22:39:39.605-0800 [initandlisten] openssl version: openssl 1.0.1e-fips 11 feb 2013 2014-12-31t22:39:39.605-0800 [initandlisten] build info: linux ip-10-41-128-95 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 X86_64 boost_lib_version=1_49 2014-12-31t22:39:39.605-0800 [initandlisten] allocator: tcmalloc 2014-12-31T22:39:39.605-0800 [initandlisten] options: { systemlog: { verbosity: 1 } } 2014-12-31t22:39:39.605-0800 [initandlisten] user assertion: 10296: ********************************************************************* error : dbpath (/data/db) does not exist. Create this directory or give existing directory in --dbpath. see http://dochub.mongodb.org/core/startingandstoppingmongo *************************************** 2014-12-31t22:39:39.703-0800 [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 2014-12-31t22:39:39.703-0800 [initandlisten] dbexit: 2014-12-31T22:39:39.703-0800 [initandlisten] shutdown: Going to&nbsP;close listening sockets... 2014-12-31t22:39:39.703-0800 [initandlisten ] shutdown: going to flush diaglog... 2014-12-31t22 :39:39.703-0800 [initandlisten] shutdown: going to close sockets... 2014-12-31t22:39:39.704-0800 [initandlisten] shutdown: waiting for fs preallocator... 2014-12-31t22:39:39.704-0800 [initandlisten] shutdown: lock for final commit... 2014-12-31t22:39:39.704-0800 [ initandlisten] shutdown: final commit... 2014-12-31t22:39:39.704-0800 [initandlisten] shutdown: closing all files... 2014-12-31t22 : 39:39.704-0800 [initandlisten] closeallfiles () finished 2014-12-31t22 : 39:39.704-0800 [INITANDLISTEN]&NBSp;dbexit: really exiting now
To view the default configuration document:
Dbpath=/var/lib/mongo
Reload the configuration document:
Mongod–f/etc/mongod.conf
Log on again after normal:
Mongo
Get information:
MongoDB Shell version:2.6.6 connecting To:test Welcome to the MongoDB shell. For interactive help, type ' help '. For more comprehensive documentation, see http://docs.mongodb.org/Questions? Try the support group Http://groups.google.com/group/mongodb-user >
This article is from the "Margin with Wish" blog, please be sure to keep this source http://281816327.blog.51cto.com/907015/1598277
MongoDB Learning Note 3 handles MongoDB connection errors