数据库为空时,mongodb创建80个文件,每个文件2GB [英] mongodb creates 80+ files 2GB each while database is empty

查看:59
本文介绍了数据库为空时,mongodb创建80个文件,每个文件2GB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

我设置了副本集,并使用不同的端口在本地主机上启动了3个mongod实例(1个arbiterOnly).

I set the replicaSet and initiated 3 instances (1 arbiterOnly) of mongod on localhost using different ports.

我还没有注意到mongo正在创建太多数量和大小都没有意义的文件.

I haven noticed that mongo is creating way too many files in numbers and size which does not make sense at all.

看到,从来没有数据插入到mongodb中,没有创建单个集合,但是,让它运行了大约一个小时,我的/data/DB_INSTANCE_X充满了2GB的文件

See, no data was ever inserted into mongodb, not a single collection was created, and yet, letting it run for hour or so, and I have my /data/DB_INSTANCE_X full of 2GB files.

我知道可以使用预分配标志定义事实文件的大小,但是,在输入单个文档之前,这么多文件对我来说似乎是错误的.

I am aware of the fact file's size can be defined with pre allocation flag, yet, so many files, before a single document was entered seems wrong to me.

推荐答案

这听起来像是在为oplog预先分配空间.无论您将什么内容插入数据库 http://www.mongodb.org/display,操作日志都会被分配/DOCS/Excessive + Disk + Space :

It sounds like it's preallocating space for the oplog. The oplog is allocated regardless of what you have inserted into the database http://www.mongodb.org/display/DOCS/Excessive+Disk+Space:

复制操作日志已作为上限集合预先分配给 本地数据库.

The replication oplog is preallocated as a capped collection in the local database.

默认分配约为磁盘空间的5%(64位) 安装).

The default allocation is approximately 5% of disk space (64 bit installations).

如果您希望使用较小的oplog大小,请使用--oplogSize 命令 线路参数.

If you would like a smaller oplog size use the --oplogSize command line parameter.

这篇关于数据库为空时,mongodb创建80个文件,每个文件2GB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆