【MongoDB学习笔记3】处理MongoDB连接错误
安装MongoDB后第一次启用shell登录1
mongo
会出现一下的错误:
1
warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
用一下命令查看以下相关的信息:
1
mongod –v
输出以下信息:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 BackgroundJob starting: DataFileSync
2014-12-31T22:39:39.604-0800 MongoDB starting : pid=20666 port=27017 dbpath=/data/db 64-bit host=localhost.localdomain
2014-12-31T22:39:39.605-0800 db version v2.6.6
2014-12-31T22:39:39.605-0800 git version: 608e8bc319627693b04cc7da29ecc300a5f45a1f modules: enterprise
2014-12-31T22:39:39.605-0800 OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
2014-12-31T22:39:39.605-0800 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 allocator: tcmalloc
2014-12-31T22:39:39.605-0800 options: { systemLog: { verbosity: 1 } } 2014-12-31T22:39:39.605-0800 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 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 dbexit:
2014-12-31T22:39:39.703-0800 shutdown: going to close listening sockets...
2014-12-31T22:39:39.703-0800 shutdown: going to flush diaglog...
2014-12-31T22:39:39.703-0800 shutdown: going to close sockets...
2014-12-31T22:39:39.704-0800 shutdown: waiting for fs preallocator... 2014-12-31T22:39:39.704-0800 shutdown: lock for final commit...
2014-12-31T22:39:39.704-0800 shutdown: final commit...
2014-12-31T22:39:39.704-0800 shutdown: closing all files...
2014-12-31T22:39:39.704-0800 closeAllFiles() finished
2014-12-31T22:39:39.704-0800 dbexit: really exiting now
查看默认的配置文档:
1
dbpath=/var/lib/mongo
重新加载配置文档:
1
mongod –f /etc/mongod.conf
再次登录后正常:
1
mongo
得到信息:
1
2
3
4
5
6
7
8
9
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
>
页:
[1]