为托管 wiki 系统选择分片键
假设我们的项目是一个托管的 wiki 服务。每个公司都将其 wiki 存储在我们的服务器上,每个公司的用户只能访问自己公司的 wiki。这些 wiki 有页面,每个页面都有修订历史记录。
现在,有几个 MongoDB 新手问题:
对于此类信息来说,什么是好的分片键?
我可以选择一个分片键,以保证一家公司的所有数据始终由一个分片管理(当然假设没有一家公司拥有的数据多于一个分片可以容纳的数据)?
分片键的选择如何保证所有服务器负载均等?例如,如果我按公司名称进行分片,并且某些公司比其他公司拥有更多的 wiki 数据,那么我将有一些分片非常繁忙,而其他分片则不然。
Say our project is a hosted wiki service. Each company stores its wikis at our servers and users from each company only ever accesses their own company's wikis. These wikis have pages, and each page has a revision history.
Now, a few MongoDB noob questions:
What would be a good shard key for this sort of information?
Can I choose a shard key so that it is guaranteed that all of a company's data will always be managed by one shard (assuming of course no company has more data than one shard can hold)?
How can the choice of shard key guarantee that all servers are equally loaded? e.g. if I shard by the company name and some companies have more wiki data than others, then I'll have some shards very busy while others not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要真正了解分片,除了 mongo.com 网站上记录的内容之外,请阅读这本书,它很短,但信息非常丰富,并提供了很好的示例...
扩展 MongoDB
To really understand sharding, beyond what is documented on the mongo.com site, read this book, it's short, but very informative and provides great examples...
Scaling MongoDB