I have started learning MongoDB and for which trying to install it on Ubuntu (which I recently shifted from windows). Facing issues to start it with sudo service mongodb start
. Following are the logs:
Sun Aug 4 20:25:36.774 [initandlisten] options: { config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }
**************
Error: journal files are present in journal directory, yet starting without journaling enabled.
It is recommended that you start with journaling enabled so that recovery may occur.
**************
Sun Aug 4 20:25:36.774 [initandlisten] exception in initAndListen: 13597 can't start without --journal enabled when journal/ files are present, terminating
Sun Aug 4 20:25:36.774 dbexit:
Sun Aug 4 20:25:36.774 [initandlisten] shutdown: going to close listening sockets...
删除日志文件: /var/lib/mongodb/journal
下的所有内容(如果要禁用日志记录(不建议)或使用日志记录:在配置文件中为journal=true
或从命令行使用--journal
。
If MongoDB has been shutdown forcefully then the journal files are not cleaned up. The warning is here so that you can decide whether you want to recover from a failure (recommended). For recovery to work, you need to start MongoDB with --journal
. Journalling is turned on by default though so I expect your /etc.mongodb.conf
file has a nojournal=true
line. You can remove that one instead as well.
If you really don't care about recovering, then you can simply remove all the files under /var/lib/mongodb/journal
—but realise that you might end up with broken data files.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.