一尘不染

为什么在Linux上错误mongod死了,但子系统被锁定,可用空间不足以存放日志文件?

linux

我已经在Linux CentOS服务器上安装了 mongo-10gen mongo-10gen- server。

我遵循 Link 的步骤。

我已经将 /etc/mongod.conf 配置为-

logpath=/var/log/mongo/mongod.log
port=27017
dbpath=/var/lib/mongo

我已经在 iptables中 为mongo设置了端口27017 。要启动mongo,我使用了命令-

service mongod start and
mongo

一切顺利,但是几天后我收到了错误消息-

Tue Jan 29 08:41:54 [initandlisten] ERROR: Insufficient free space for journal files
Tue Jan 29 08:41:54 [initandlisten] Please make at least 3379MB available in /var/lib/mongo/journal or use --smallfiles
Tue Jan 29 08:41:54 [initandlisten]
Tue Jan 29 08:41:54 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
Tue Jan 29 08:41:54 dbexit:
Tue Jan 29 08:41:54 [initandlisten] shutdown: going to close listening sockets...
Tue Jan 29 08:41:54 [initandlisten] shutdown: going to flush diaglog...
Tue Jan 29 08:41:54 [initandlisten] shutdown: going to close sockets...
Tue Jan 29 08:41:54 [initandlisten] shutdown: waiting for fs preallocator...
Tue Jan 29 08:41:54 [initandlisten] shutdown: lock for final commit...
Tue Jan 29 08:41:54 [initandlisten] shutdown: final commit...
Tue Jan 29 08:41:54 [initandlisten] shutdown: closing all files...
Tue Jan 29 08:41:54 [initandlisten] closeAllFiles() finished
Tue Jan 29 08:41:54 [initandlisten] journalCleanup...
Tue Jan 29 08:41:54 [initandlisten] removeJournalFiles
Tue Jan 29 08:41:54 [initandlisten] shutdown: removing fs lock...
Tue Jan 29 08:41:54 dbexit: really exiting now

当我执行命令时-

service mongod status

它给出了错误-

mongod dead but subsys locked

请帮助我解决 mongod死但子系统被锁定 以及 期刊可用空间不足 的问题 ,从而终止


阅读 288

收藏
2020-06-03

共1个答案

一尘不染

您可以将以下内容添加到运行时提供的配置文件中 mongod --config mongod.conf

对于MongoDB 3.x (最新版本)

storage:
   mmapv1:
      smallFiles: true

对于 2.6+* 版本 *

storage:
   smallFiles: true

对于 2.4 及以下版本

smallfiles = true

然后只需执行mongod接受您的配置文件(此处假定配置位置为 /etc/mongodb.conf ):

mongod -f /etc/mongodb.conf

文档smallfiles 参数:

Set to true to modify MongoDB to use a smaller default data file size. 
Specifically, smallfiles reduces the initial size for data files and
limits them to 512 megabytes. The smallfiles setting also reduces the
size of each journal files from 1 gigabyte to 128 megabytes.
2020-06-03