gpt4 book ai didi

linux - 为什么在 Linux 上出现错误 mongod dead 但 subsys 被锁定和日志文件可用空间不足?

转载 作者:IT老高 更新时间:2023-10-28 11:14:37 25 4
gpt4 key购买 nike

我已经在 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 dead but subsys locked日志可用空间不足,终止的问题强>

最佳答案

您可以在运行 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

Documentation对于 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.

关于linux - 为什么在 Linux 上出现错误 mongod dead 但 subsys 被锁定和日志文件可用空间不足?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14584393/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com