【MongoDB學習筆記3】處理MongoDB串連錯誤

來源:互聯網
上載者:User

標籤: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    >


本文出自 “緣隨心愿” 部落格,請務必保留此出處http://281816327.blog.51cto.com/907015/1598277

【MongoDB學習筆記3】處理MongoDB串連錯誤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.