MongoDb数据库与集合 [英] MongoDb Database vs Collection

查看:83
本文介绍了MongoDb数据库与集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个使用MongoDb(64位版本)的系统来处理大量用户(大约100,000个),每个用户将拥有大量数据(大约100万个记录).

I am designing a system with MongoDb (64 bit version) to handle a large amount of users (around 100,000) and each user will have large amounts of data (around 1 million records).

最佳的设计策略是什么?

What is the best strategy of design?

  1. 转储单个集合中的所有记录

  1. Dump all records in single collection

为每个用户收集一个

为每个用户拥有一个数据库.

Have a database for each user.

非常感谢,

推荐答案

因此,您正在查找的区域大约为1000亿条记录(100万条记录* 100,000个用户).

So you're looking at somewhere in the region of 100 billion records (1 million records * 100,000 users).

处理大量数据的首选方法是创建一个分片群集,该群集将数据通过mongo客户端作为单个逻辑单元呈现在多个服务器上进行拆分.

The preferred way to deal with large amounts of data is to create a sharded cluster that splits the data out over several servers that are presented as single logical unit via the mongo client.

因此,您的问题的答案是将所有记录放入一个单独的分片集合中.

Therefore the answer to your question is put all your records in a single sharded collection.

所需的分片数量和集群的配置与数据的大小以及其他因素(例如读写的数量和分布)有关.这些问题的答案可能非常适合您的特殊情况,因此我不会尝试猜测它们.

The number of shards required and configuration of the cluster is related to the size of the data and other factors such as the quantity and distribution of reads and writes. The answers to those questions are probably very specific to your unique situation, so I won't attempt to guess them.

我可能首先要确定您有多少个分片有足够的时间和机器来在这么多机器的集群上设置和测试系统.基于这种性能,您可以决定集群中需要更多还是更少的分片

I'd probably start by deciding how many shards you have the time and machines available to set up and testing the system on a cluster of that many machines. Based on the performance of that, you can decide whether you need more or fewer shards in your cluster

这篇关于MongoDb数据库与集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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