为什么得到错误的mongod死了,但SUBSYS锁定,并没有足够的可用空间,在Linux日志文件?(

2019-07-18 22:11发布

我已经安装了Linux CentOS的服务器上蒙戈-蒙戈10gen的,10gen公司的服务器

我跟着从台阶链接

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

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

我已经设置端口为27017 iptables中蒙戈。 要启动蒙戈我的命令 -

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死的问题,但SUBSYS锁定 和杂志可用空间不足,终止

Answer 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.


Answer 2:

开始mongod使用下面的命令实例

mongod --dbpath /data/db --smallfiles


Answer 3:

我在之后的官方指导http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

使用后

$sudo service mongod start

我去验证是否MongoDB中通过审查该日志已成功启动:

/var/log/mongodb/mongod.log

这是我发现了问题:

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

解:

在文件/etc/mongod.conf结束时,我加入这一行:

smallfiles = true

在那之后,我重新启动mongod的服务:

$sudo service mongod restart

然后,当我去查看日志,我意识到,一切都很完美,而且问题得到了解决:

2014-11-11T22:32:20.544-0500 ***** SERVER RESTARTED *****
2014-11-11T22:32:20.552-0500 [initandlisten] MongoDB starting : pid=5200 port=27017 dbpath=/var/lib/mongodb 64-bit host=jaimemontoya-VirtualBox
2014-11-11T22:32:20.552-0500 [initandlisten] db version v2.6.5
2014-11-11T22:32:20.552-0500 [initandlisten] git version: e99d4fcb4279c0279796f237aa92fe3b64560bf6
2014-11-11T22:32:20.552-0500 [initandlisten] build info: Linux build8.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-11-11T22:32:20.552-0500 [initandlisten] allocator: tcmalloc
2014-11-11T22:32:20.552-0500 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, storage: { dbPath: "/var/lib/mongodb", smallFiles: true }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2014-11-11T22:32:20.564-0500 [initandlisten] journal dir=/var/lib/mongodb/journal
2014-11-11T22:32:20.564-0500 [initandlisten] recover : no journal files present, no recovery needed
2014-11-11T22:32:20.738-0500 [initandlisten] waiting for connections on port 27017
2014-11-11T22:33:20.748-0500 [clientcursormon] mem (MB) res:36 virt:245
2014-11-11T22:33:20.748-0500 [clientcursormon]  mapped (incl journal view):64
2014-11-11T22:33:20.748-0500 [clientcursormon]  connections:0


Answer 4:

对于有这个问题,尽管有足够的空间用于创建日志文件的任何人。

我的问题:我有足够多的空间,要创建的日志文件。 蒙戈给了我一个连接失败的问题。 我使用kill命令来杀死mongod的过程,反过来给我的SUBSYS问题。 这里是我工作:

转到/var/lock/subsys和删除文件mongod

现在service mongod stop ,然后service mongod start

现在开始蒙戈外壳,一切似乎运行良好。



Answer 5:

第一

cd /usr/local/src/mongo/bin/<br>

然后

./mongod --dbpath /usr/local/src/mongo/data/db/ --smallfiles


Answer 6:

刚一说明,这帮助了我。 尽管有以蒙戈没有相关的技术问题。 这只是系统的空间不足。 清除系统缓存摸索出我和蒙戈回了平稳运行。

yum clean all


文章来源: Why getting error mongod dead but subsys locked and Insufficient free space for journal files on Linux?