本文介绍了为什么在Linux上错误mongod死了,但子系统被锁定,可用空间不足,无法保存日志文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have installed mongo-10gen mongo-10gen-server on Linux CentOS server.

我遵循了 链接 .

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

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

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

I have set port 27017 for mongo in iptables.To start mongo I used commands -

service mongod start and
mongo

开始得很好,但是几天后我出现了错误-

It get started well, but after few days I am getting the error -

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死亡但子系统被锁定 期刊可用空间不足,终止 的问题

Please help me to solve the problem of mongod dead but subsys locked and Insufficient free space for journals, terminating

推荐答案

您可以将以下内容添加到运行mongod --config mongod.conf

You can add following to the config file provided when running mongod --config mongod.conf

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

For MongoDB 3.x (latest version)

storage:
   mmapv1:
      smallFiles: true

对于版本 2.6 +

storage:
   smallFiles: true

对于版本 2.4 及更低版本

smallfiles = true

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

Then just execute mongod to accept your config file (here it assumes that location of the config is /etc/mongodb.conf):

mongod -f /etc/mongodb.conf

参数的

文档:

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.

这篇关于为什么在Linux上错误mongod死了,但子系统被锁定,可用空间不足,无法保存日志文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 22:02