如何跨多个服务器对 Mysql 进行分区?
我知道水平分区...您可以创建许多表。
如何使用多个服务器来做到这一点? 这将允许 Mysql 进行扩展。
在 X 服务器上创建 X 表?
有没有人愿意解释一下,或者有一个很好的初学者教程(逐步)来教您如何跨多个服务器进行分区?
I know that horizontal partitioning...you can create many tables.
How can you do this with multiple servers?
This will allow Mysql to scale.
Create X tables on X servers?
Does anyone care to explain, or have a good beginner's tutorial (step-by-step) that teaches you how to partition across multiple servers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 MySQL,人们通常会执行所谓的基于应用程序分片。
简而言之,您将在多个数据库服务器上拥有相同的数据库结构。但它不会包含相同的数据。
举个例子:
分片(当然)不是一种备份技术,它的目的是跨集群分布读取和写入。
例如,用于分片的技术是 MySQL-Proxy。这不是 HScale 发明的,它或多或少是一个简单的 LUA 脚本,它将读取和写入分发到不同的后端服务器。 MySQL forge 上应该有很多例子。
另一个工具(基于 MySQL Proxy)是 SpockProxy。完全针对分片而定制。他们还摆脱了 Lua,并进行了各种工作以使其比代理更快。到目前为止,我只测试了 SpockProxy,但从未在生产中运行过它。
现在除了这些代理之外,您还可以对自己进行分片。需要一个主表,例如:
然后构建对服务器的读取和写入。不是很漂亮但是有效。下一个障碍是让它变得更加耐摔。例如,
server1
、server2
和server3
每个都应该是一个小集群。最后但并非最不重要的一点是,另一个有趣的跨服务器分区数据和索引的方法是 Digg 的 IDDB。我不确定他们是否发布了其代码,但他们的博客文章提供了有关其功能的详细信息。
让我知道这是否有帮助!
With MySQL, people generally do what is called application based sharding.
In a nutshell, you will have the same database structure on multiple database servers. But it won't contain the same data.
So for example:
Sharding (of course) is not a backup technique, it's meant to distribute reads and writes across a cluster.
Techniques employed to shard are the MySQL-Proxy, for example. This is nothing that HScale invented, it's more or less a simple LUA script which distributes reads and writes to different backend servers. There should be plenty of examples on the MySQL forge.
Another tool (based on MySQL Proxy) is SpockProxy. Completely tailored towards sharding. They also got rid off Lua, and they worked on various things to make it speedier than the proxy. So far, I have only tested SpockProxy, but never ran it in production.
Now aside from those proxies, you can shard yourself as well. Required would be a master table, e.g.:
Then construct your reads and writes towards the server. Not very pretty but that works. The next obstactle would be to make it more falt tolarant. So for example,
server1
,server2
andserver3
each should be a small cluster.And last but not least, another interesting approach to partition data and indices across servers is Digg's IDDB. I'm not sure if they ever released its code, but their blog posts gives great details on what it does.
Let me know if this helps!
但您需要记住,如果您出于某种原因想要将此解决方案引入云并使其成为多租户,那么上述配置可能会变得更具挑战性。考虑一下 -
所以现在的问题是,您可能需要考虑如何在主从环境中进行分片,其中从设备通常用于读取,主设备用于写入。
干杯!
加里
But you need to keep in mind that if you for some reasons want to take this solution to cloud and make it multi tenant then the above configuration might become more challenging. Think about this -
So now the question is that you will probably need to think how can you do this sharding in a mster-slave kind of env where slaves are typically for reading and masters for writing.
cheers !
Gary
HSCALE 0.1 的公告中写道:
看看这个项目: http://sourceforge.net/projects/hscale/< /a> 也许它适合你。
Here what is written at the announce of HSCALE 0.1:
Have a look at this project : http://sourceforge.net/projects/hscale/ maybe it will be suitable for you.