search

Home  >  Q&A  >  body text

mongodb分布式存储的原理是什么?

这两天刚开始学mongodb,试着建了分布式存储。

不明白他的基本原理是什么?

我的测试数据库:

weibo文档里有0.156G数据

建立了四个shard节点,发现每个节点的数据是平均分的,这是怎么实现分配的?

然后我把整个weibo清空,文件存储大小不变,为啥呢?

求高手解答。

怪我咯怪我咯2895 days ago723

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-24 09:15:36

    You need to first look at the basic principles of sharding in MongoDB. Here is a translated document by Xiao Beibei: http://docs.mongoing.com/manual-zh/core/sharding-introduction.html

    Regarding point 2, MongoDB will not reclaim space in the file system after you delete the record. Unless you delete the database. But the space is not wasted and will be used to store the new document inserted below. For specific information on space usage, please see my blog: http://mongoing.com/blog/file-storage

    reply
    0
  • Cancelreply