我正在尝试运行命令
mongod --dbpath=data/db
当我收到此错误时:
mongod --dbpath=data/db
[initandlisten] MongoDB starting : pid=10161 port=27017 dbpath=data/db 64-bit host=anr
[initandlisten] db version v2.4.9
[initandlisten] git version: 52fe0d21959e32a5bdbecdc62057db386e4e029c
[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
[initandlisten] allocator: tcmalloc
[initandlisten] options: { dbpath: "data/db" }
[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
dbexit:
[initandlisten] shutdown: going to close listening sockets...
[initandlisten] shutdown: going to flush diaglog...
[initandlisten] shutdown: going to close sockets...
[initandlisten] shutdown: waiting for fs preallocator...
[initandlisten] shutdown: lock for final commit...
[initandlisten] shutdown: final commit...
[initandlisten] shutdown: closing all files...
[initandlisten] closeAllFiles() finished
dbexit: really exiting now
这是我的 /data/db:
.:
total 4
drwxrwxrwx 3 root root 4096 Mar 26 11:24 db
./db:
total 81928
drwxr-xr-x 2 anr anr 4096 Mar 26 16:07 journal
-rw------- 1 anr anr 67108864 Mar 26 16:07 local.0
-rw------- 1 anr anr 16777216 Mar 26 16:07 local.ns
-rwxr-xr-x 1 anr anr 0 Mar 26 16:07 mongod.lock
./db/journal:
total 3145740
-rw------- 1 anr anr 1073741824 Mar 26 16:07 prealloc.0
-rw------- 1 anr anr 1073741824 Mar 25 17:36 prealloc.1
-rw------- 1 anr anr 1073741824 Mar 25 17:36 prealloc.2
更新:
修改了我的 /data/db 路径,这是错误:
[initandlisten] allocator: tcmalloc
[initandlisten] options: { dbpath: "/data/db" }
[initandlisten] journal dir=/data/db/journal
[initandlisten] recover : no journal files present, no recovery needed
[initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for
socket: 0.0.0.0:27017
[initandlisten] ERROR: addr already in use
[initandlisten] now exiting
[websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket:
0.0.0.0:28017
[websvr] ERROR: addr already in use
更新2:
mongodb 10172 1 0 16:11 ? 00:00:27 /usr/bin/mongod --config
/etc/mongodb.conf
anr 10865 5108 0 17:07 pts/0 00:00:00 grep --colour=auto mongod