0

我使用的是 MongoDB 2.4,当我第一次启动 mongo 时,我在一台服务器上获得了 9GB 的日志文件,而在第二台服务器上我只获得了 0.5GB 的日志文件。在第一台服务器上,加载 MongoDB 需要 5 分钟!第二个需要几秒钟。两个实例都没有数据并且第一次运行。每台服务器独立工作,两者互不相关。每个服务器都有自己的分片(所有分片 - 其中 3 个在同一服务器中)。

这意味着对于我拥有的每台服务器:

/usr/mongodb/bin/mongod --configsvr --dbpath /data/svr1 --port 27019

/usr/mongodb/bin/mongod --configsvr --dbpath /data/svr2 --port 27020

/usr/mongodb/bin/mongod --configsvr --dbpath /data/svr3 --port 27021

/usr/mongodb/bin/mongod --dbpath /data/db1 --port 27010

/usr/mongodb/bin/mongod --dbpath /data/db2 --port 27011

/usr/mongodb/bin/mongod --dbpath /data/db3 --port 27012

/usr/mongodb/bin/mongos --configdb localhost:27019,localhost:27020,localhost:27021

以及创建分片的脚本:

sh.addShard("localhost:27010");

sh.addShard("localhost:27011");

sh.addShard("localhost:27012");

sh.enableSharding("somescheme");

我想知道为什么我在第一个日志中获得 9GB 文件,第二个为 0.5GB?第一个有更大的硬盘而不是SSD,第二个是SSD并且更小。有任何想法吗?谢谢!!!

4

1 回答 1

0

如果 MongoDB 决定这样做更好,它将预先分配日志文件。检查您的日志是否有类似的内容:

Thu Mar 10 20:49:33 [initandlisten] preallocating a journal file db/journal/prealloc.0
Thu Mar 10 20:52:49 [initandlisten] preallocating a journal file db/journal/prealloc.1
于 2013-06-19T05:35:12.740 回答