在输入“service mongod restart”后,我收到错误“子进程失败,退出时错误编号为 45”,然后我检查了 /var/log/mongo/mongo.log,如下所示:
SERVER RESTARTED
Sat Dec 21 12:28:59.115 [initandlisten] MongoDB starting : pid=1446 port=27017 dbpath=
/var /lib/mongo 32-bit host=server.xfloyd.com.ar
Sat Dec 21 12:28:59.115 [initandlisten]
Sat Dec 21 12:28:59.115 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Sat Dec 21 12:28:59.115 [initandlisten] ** 32 bit builds are limited to
less than 2GB of data (or less with --journal).
Sat Dec 21 12:28:59.115 [initandlisten] ** Note that journaling defaults to off for
32 bit and is currently off.
Sat Dec 21 12:28:59.115 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
Sat Dec 21 12:28:59.115 [initandlisten]
Sat Dec 21 12:28:59.115 [initandlisten] db version v2.4.6
Sat Dec 21 12:28:59.115 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
Sat Dec 21 12:28:59.115 [initandlisten] build info: Linux bs-linux32.10gen.cc 2.6.21.7-2.
fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_49
Sat Dec 21 12:28:59.115 [initandlisten] allocator: system
Sat Dec 21 12:28:59.115 [initandlisten] options: { config: "/etc/mongod.conf", dbpath:
"/var/lib/mongo", fork: "true", logappend: "true", logpath: "/var/log/mongo/mongod.log"
, pidfilepath: "/var/run/mongodb/mongod.pid" }
Sat Dec 21 12:28:59.146 [initandlisten] couldn't open /var/lib/mongo/local.ns errno:
13 Permission denied
Sat Dec 21 12:28:59.146 [initandlisten] error couldn't open file /var/lib/mongo/
local.ns terminating
Sat Dec 21 12:28:59.146 dbexit:
Sat Dec 21 12:28:59.146 [initandlisten] shutdown: going to close listening sockets...
Sat Dec 21 12:28:59.146 [initandlisten] shutdown: going to flush diaglog...
Sat Dec 21 12:28:59.146 [initandlisten] shutdown: going to close sockets...
Sat Dec 21 12:28:59.146 [initandlisten] shutdown: waiting for fs preallocator...
Sat Dec 21 12:28:59.146 [initandlisten] shutdown: closing all files...
Sat Dec 21 12:28:59.146 [initandlisten] closeAllFiles() finished
Sat Dec 21 12:28:59.146 [initandlisten] shutdown: removing fs lock...
Sat Dec 21 12:28:59.146 dbexit: really exiting now
答案1
Sat Dec 21 12:28:59.146 [initandlisten] error couldn't open file /var/lib/mongo/local.ns
terminating
该行最具诊断意义。验证/var/lib/mongo
对运行 Mongo 服务的用户(或者如果直接调用,则为调用 mongodb 的用户)的权限是否足够。该local.ns
文件是 Mongo 数据库文件,默认情况下保存在 中/var/lib/mongo
。