1 问题形容

   应用程序和MongoDB运行时,在查问和读取文件的时候产生的文件量较多。


1.查问索引

 db.page.getIndexes()

2.配置conf

# Where and how to store data.storage:  dbPath: /var/lib/mongo  #dbPath: /mongodata   journal:    enabled: true#  engine:  mmapv1:    smallFiles: true  wiredTiger:    engineConfig:      configString : cache_size=512M

或者

systemLog: destination: file path: "D:\\db.log" logAppend: truestorage: dbPath: "D:\\db" directoryPerDB: true journal:  enabled: true wiredTiger:  engineConfig:   cacheSizeGB: 0.256net: bindIp: 127.0.0.1 port: 27017security: authorization: disabled

呈现这种状况的起因:

   1.索引问题,加上指定的内存,会导致启动索引会吃掉所有内存导致杀死过程,以致于mongodb内存溢出关机,mongodb的重建索引的时候,吃掉所有内存。   2.就是决定它本人要用多少内存的代码了。先留出1G,而后再留出40%,剩下的能吃就吃!这种状况在机器内存少的时候没有呈现,大略是因为内存少的时候,mongod 留出的比例比拟高,内核就没那么卖命地把数据往 swap 上挪了,后果造成内核挪多少,mongod 吃多少……

解决办法:

   要配置mongoDB的内存为MB

当你的内存大于1GB,mongodb会用掉 内存的60% - 1GB 的内存作为缓存;
当你的内存小于1GB,mongodb会间接用掉1GB。