====== クラッシュ対応 ====== ====== クラッシュ、kill後の対応 ====== ===== クラッシュ後の起動に失敗 ===== # /etc/init.d/mongod start Starting mongod: about to fork child process, waiting until server is ready for connections. all output going to: /var/log/mongo/mongod.log forked process: 1820 ERROR: child process failed, exited with error number 100 [FAILED] ===== ログファイルを確認する ===== ***** SERVER RESTARTED ***** Mon May 27 22:46:52.124 [initandlisten] MongoDB starting : pid=1820 port=27017 dbpath=/var/lib/mongo 64-bit host=mongo01 Mon May 27 22:46:52.124 [initandlisten] db version v2.4.1 Mon May 27 22:46:52.124 [initandlisten] git version: 1560959e9ce11a693be8b4d0d160d633eee75110 Mon May 27 22:46:52.124 [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 Mon May 27 22:46:52.124 [initandlisten] allocator: tcmalloc Mon May 27 22:46:52.124 [initandlisten] options: { config: "/etc/mongod.conf", dbpath: "/var/lib/mongo", fork: "true", logappend: "true", logpath: "/var/log/mongo/mongod.log", nojournal: "true", pidfilepath: "/var/run/mongodb/mongod.pid" } ************** Unclean shutdown detected. Please visit http://dochub.mongodb.org/core/repair for recovery instructions. ************* Mon May 27 22:46:52.125 [initandlisten] exception in initAndListen: 12596 old lock file, terminating Mon May 27 22:46:52.125 dbexit: Mon May 27 22:46:52.125 [initandlisten] shutdown: going to close listening sockets... Mon May 27 22:46:52.125 [initandlisten] shutdown: going to flush diaglog... Mon May 27 22:46:52.125 [initandlisten] shutdown: going to close sockets... Mon May 27 22:46:52.125 [initandlisten] shutdown: waiting for fs preallocator... Mon May 27 22:46:52.125 [initandlisten] shutdown: closing all files... Mon May 27 22:46:52.125 [initandlisten] closeAllFiles() finished Mon May 27 22:46:52.125 dbexit: really exiting now ===== repair実行⇒失敗 ===== # mongod --repair Mon May 27 22:45:21.146 [initandlisten] MongoDB starting : pid=1806 port=27017 dbpath=/data/db/ 64-bit host=mongo01 Mon May 27 22:45:21.146 [initandlisten] db version v2.4.1 Mon May 27 22:45:21.146 [initandlisten] git version: 1560959e9ce11a693be8b4d0d160d633eee75110 Mon May 27 22:45:21.146 [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 Mon May 27 22:45:21.146 [initandlisten] allocator: tcmalloc Mon May 27 22:45:21.146 [initandlisten] options: { repair: true } Mon May 27 22:45:21.147 [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 Mon May 27 22:45:21.147 dbexit: Mon May 27 22:45:21.147 [initandlisten] shutdown: going to close listening sockets... Mon May 27 22:45:21.147 [initandlisten] shutdown: going to flush diaglog... Mon May 27 22:45:21.147 [initandlisten] shutdown: going to close sockets... Mon May 27 22:45:21.147 [initandlisten] shutdown: waiting for fs preallocator... Mon May 27 22:45:21.147 [initandlisten] shutdown: closing all files... Mon May 27 22:45:21.147 [initandlisten] closeAllFiles() finished Mon May 27 22:45:21.147 dbexit: really exiting now ===== DBのパスを指定してrepair実行 ===== # mongod --repair --dbpath=/var/lib/mongo ===== repair終わったので実行⇒失敗 ===== # /etc/init.d/mongod start Starting mongod: about to fork child process, waiting until server is ready for connections. all output going to: /var/log/mongo/mongod.log forked process: 1883 ERROR: child process failed, exited with error number 45 [FAILED] ===== ログをみる ===== Mon May 27 22:49:56.114 [initandlisten] MongoDB starting : pid=1883 port=27017 dbpath=/var/lib/mongo 64-bit host=mongo01 Mon May 27 22:49:56.114 [initandlisten] db version v2.4.1 Mon May 27 22:49:56.114 [initandlisten] git version: 1560959e9ce11a693be8b4d0d160d633eee75110 Mon May 27 22:49:56.114 [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 Mon May 27 22:49:56.114 [initandlisten] allocator: tcmalloc Mon May 27 22:49:56.114 [initandlisten] options: { config: "/etc/mongod.conf", dbpath: "/var/lib/mongo", fork: "true", logappend: "true", logpath: "/var/log/mongo/mongod.log", nojournal: "true", pidfilepath: "/var/run/mongodb/mongod.pid" } Mon May 27 22:49:56.201 [initandlisten] couldn't open /var/lib/mongo/mong_log.ns errno:13 Permission denied Mon May 27 22:49:56.201 [initandlisten] error couldn't open file /var/lib/mongo/mong_log.ns terminating Mon May 27 22:49:56.201 dbexit: Mon May 27 22:49:56.201 [initandlisten] shutdown: going to close listening sockets... Mon May 27 22:49:56.201 [initandlisten] shutdown: going to flush diaglog... Mon May 27 22:49:56.201 [initandlisten] shutdown: going to close sockets... Mon May 27 22:49:56.201 [initandlisten] shutdown: waiting for fs preallocator... Mon May 27 22:49:56.201 [initandlisten] shutdown: closing all files... Mon May 27 22:49:56.201 [initandlisten] closeAllFiles() finished Mon May 27 22:49:56.201 [initandlisten] shutdown: removing fs lock... Mon May 27 22:49:56.201 dbexit: really exiting now ===== 権限設定 ===== # chown -R mongod:mongod /var/lib/mongo ===== 起動成功 ===== # /etc/init.d/mongod start Starting mongod: about to fork child process, waiting until server is ready for connections. all output going to: /var/log/mongo/mongod.log forked process: 1900 child process started successfully, parent exiting [ OK ] ===== 参考 ===== https://wiki.10gen.com/pages/viewpage.action?pageId=7831701