【MongoDB学习笔记3】处理MongoDB连接错误-创新互联
安装MongoDB后第一次启用shell登录
创新互联是一家集网站建设,万山企业网站建设,万山品牌网站建设,网站定制,万山网站建设报价,网络营销,网络优化,万山网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。mongo会出现一下的错误:
warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused用一下命令查看以下相关的信息:
mongod –v输出以下信息:
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 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] dbexit: really exiting now查看默认的配置文档:
dbpath=/var/lib/mongo
重新加载配置文档:
mongod –f /etc/mongod.conf再次登录后正常:
mongo得到信息:
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 >另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网页题目:【MongoDB学习笔记3】处理MongoDB连接错误-创新互联
分享链接:http://scjbc.cn/article/ceggdh.html