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

标签 linux mongodb journal

我已经在 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/

相关文章:

c - 是否可以在linux C程序中重新定义 "~/"(HOME目录)的值(无root权限)

linux - 如何grep curl -I header信息

javascript - 如何在React中将表单数据传递到MongoDB?

python - 从先前终止的连接到数据库提交 SQLite 中的现有日志文件

c++ - 我在哪里可以找到 "C/C++ Users Journal"代码存档?

linux - 狂欢 : how to use a function (which is a string param) in an other function

c - 在 linux 可加载内核模块中重新定位与位置无关的代码

java - MongoDB 树查找后代 Java

java - 如何在Java中正确使用MongoDB多线程?

logging - ubuntu 18.04如何管理/var/log/journal/中的文件?