search

Home  >  Q&A  >  body text

MongoDB副本集secondary初始化同步数据问题

场景:

由于磁盘空间不足,要替换mongoDB工作目录所在的硬盘,
其中有个db的数据差不多150G大小,现在新增了个硬盘,
新增节点从primary节点初始化同步完成后,该db的大小只有差不多70G,
看了下里面每个collection的count总数不变。

疑问:

这一个同步后,数据容量为什么会相差这么多呢?
这种全量的初始化同步方式,是会有数据压缩什么的吗?
看了文档,找了好久没找到相关信息。跪求!!!
为情所困为情所困2796 days ago559

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-04-28 09:06:41

    Because some data has been deleted. Nothing like a database automatically reduces the file size when data is deleted - this is an extremely expensive operation that requires rewriting the entire file.

    But it’s okay. Although MongoDB is not PostgreSQL and does not have automatic sorting, MongoDB is not MySQL either and even manual sorting is not possible. You try the compact command, if that doesn't work, try repair. I did it before, but I forgot about it now.

    reply
    0
  • Cancelreply