mysql 跨服务器_如何跨多个服务器分区Mysql?

bd96500e110b49cbb3cd949968f18be7.png

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?

解决方案

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:

Users 1 - 10000: server A

Users 10001 - 20000: server B

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.:

-------------------

| userA | server1 |

| userB | server2 |

| userC | server1 |

-------------------

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 and server3 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!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值