在輸入“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
.