ubuntu 14.04在重启Mongodb服务的时候报错,如下:
root@iZ233u1ods1Z:~# service mongodb restart
stop: Unknown instance:
mongodb start/running, process 27809
之后尝试通过“mongo”命令尝试打开Mongo服务,结果失败并提示查看Mongo日志,日志内容如下:
***** SERVER RESTARTED *****
Thu Mar 8 16:19:35.815 [initandlisten] MongoDB starting : pid=31763 port=27017 dbpath=/var/lib/mongodb 64-bit host=iZ233u1ods1Z
Thu Mar 8 16:19:35.816 [initandlisten] db version v2.4.9Thu Mar 8 16:19:35.816 [initandlisten] git version: nogitversion
Thu Mar 8 16:19:35.816 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54
Thu Mar 8 16:19:35.816 [initandlisten] allocator: tcmalloc
Thu Mar 8 16:19:35.816 [initandlisten] options: { bind_ip: "115.29.245.8", config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", journal: "true", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }
Thu Mar 8 16:19:35.825 [initandlisten] journal dir=/var/lib/mongodb/journal
Thu Mar 8 16:19:35.825 [initandlisten] recover : no journal files present, no recovery needed
Thu Mar 8 16:19:35.825 [initandlisten]
Thu Mar 8 16:19:35.825 [initandlisten] ERROR: Insufficient free space for journal files
Thu Mar 8 16:19:35.825 [initandlisten] Please make at least 3379MB available in /var/lib/mongodb/journal or use --smallfiles
Thu Mar 8 16:19:35.825 [initandlisten]
Thu Mar 8 16:19:35.826 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
Thu Mar 8 16:19:35.826 dbexit:
Thu Mar 8 16:19:35.826 [initandlisten] shutdown: going to close listening sockets...
Thu Mar 8 16:19:35.826 [initandlisten] shutdown: going to flush diaglog...
Thu Mar 8 16:19:35.826 [initandlisten] shutdown: going to close sockets...
Thu Mar 8 16:19:35.826 [initandlisten] shutdown: waiting for fs preallocator...
Thu Mar 8 16:19:35.826 [initandlisten] shutdown: lock for final commit...
Thu Mar 8 16:19:35.826 [initandlisten] shutdown: final commit...
Thu Mar 8 16:19:35.826 [initandlisten] shutdown: closing all files...
Thu Mar 8 16:19:35.826 [initandlisten] closeAllFiles() finished
Thu Mar 8 16:19:35.826 [initandlisten] journalCleanup...
Thu Mar 8 16:19:35.826 [initandlisten] removeJournalFiles
Thu Mar 8 16:19:35.834 [initandlisten] shutdown: removing fs lock...
Thu Mar 8 16:19:35.836 dbexit: really exiting now
如上:mongo服务重启失败的原因是由于服务器的硬盘空间不足3379MB,尝试清理硬盘空间后重启Mongo服务,Mongo服务可以正常重启。