多台服务器使用单个 MySQL 数据库
我想到一个大项目,它将占用服务器资源和带宽的大量负载。它应该与不同网页的巨大MySQL数据库一起工作(也许大约2000万条,我希望MySQL能够处理这样数量的记录)。但我认为我需要在多台服务器之间共享对数据库的请求,因为一台服务器无法处理这样的负载。我想知道像 Google 或 Archive.org 这样的大型项目是如何做到这一点的?我想到了原始方法,如下:
- MySQL数据库位于独立的独立服务器上。
- MySQL 数据库表包含一个字段,例如“服务器”,具有特定的服务器名称,记录将分配给该字段进行处理。
- 每个服务器都连接 MySQL 服务器,并且仅处理分配给该服务器的记录(通过查看该表中的“服务器”字段)。
我觉得这是一种菜鸟方法,但我想知道您的意见,也许您认为如何以更优化和更聪明的形式实现这一点。
会很高兴收到任何小费。
谢谢, 丹尼斯.
I think of a big project, which gonna take much load on sever resources and bandwidth. It should work with huge MySQL database of different webpages (maybe about 20 million, I hope MySQL can handle such amount of records). But I will need to share the requests to the database between several servers I think, because one single server won't be able to handle such a load. I wonder how big projects like Google or Archive.org are doing this? I thought of primitive method, which is like follows:
- The MySQL database is located on an independent standalone server.
- The MySQL database table contains a field, say, "server", with particular server name, for which the record is allocated for processing.
- Each server connects MySQL server and works ONLY with records, which are allocated to that server (by looking into "server" field in that table).
I feel like this is a noob method, but I would like to know your opinion, and maybe the ways you see how this can be implemented in more optimized and clever form.
Will be happy for any tip.
Thanks,
Dennis.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
20M 记录对于数据库来说几乎不算什么。这都是关于你如何使用数据库、如何编写 SQL、你的数据模型等等。不要担心 20M 记录,这根本不会有任何问题。
20M records is next to nothing for a database. It's all about how your use the database, how to write your SQL, your datamodel, etc. etc. Don't worry about 20M records, that's not going to be any problem at all.