https://stackoverflow.com/questions/24427472/how-to-configure-storage-smallfiles-on-mongodb

image.png

排查方式:

查看错误日志

  1. /var/log/mongodb/mongodb.log

其中有一条: :::danger Insufficient free space for journal files :::

知道了错误原因 就可以处理了

重新修改 日志大小

Please make at least 3379MB available in /var/lib/mongodb/journal or use —smallfiles

这里使用 —smallfiles 参数

he configuration for storage option smallFiles is different in different versions of MongoDB.
MongoDB 3.0–4.0 - docs:

  1. storage:
  2. mmapv1:
  3. smallFiles: true

Note that MMAPv1 storage engine is deprecated in MongoDB 4.0 and it will be removed in future releases - docs
MongoDB 2.6 - docs:

storage:
   smallFiles: true

MongoDB 2.4 - docs:

smallfiles = true

You can check that your setting is properly set by calling this command against admin database:

db.runCommand({getCmdLineOpts:1});

You can also specify it directly when starting mongod, but that defeats the purpose of having a config file:

mongod --config /etc/mongodb.conf --smallFiles