首页 > 代码库 > MySQL Horizontal Scaling
MySQL Horizontal Scaling
http://www.tuicool.com/articles/miuq63E
http://www.guokr.com/blog/475765/
http://songwie.com/articlelist/44
https://www.youtube.com/watch?v=5yDO-tmIoXY
single database => master / slave => sharding
( at stage of master/slave, you might need to add a hot-standby master for failover, e.g. DRDB-based, http://highscalability.com/blog/2011/6/27/tripadvisor-architecture-40m-visitors-200m-dynamic-page-view.html, https://en.wikipedia.org/wiki/Distributed_Replicated_Block_Device)
after sharding, how to do "query routing"
a) application layer
b) library-as-sharding (e.g. so-called JDBC-sharding, do it at JDBC layer)
c) proxy-as-sharding
Qihoo 360 Atlas (quite primitive)
based on mysql-proxy, exposes MySQL client protocol;
add /* master */ to SQL in order to force send to master;
manual creation of partition table;
Alibaba B2B Cobar
proxy-based, query parsing / rewrite / routing, result gathering;
expose MySQL client protocol;
failover for data node; (need dual-direction replication between data nodes)
Taobao TDDL - Also as Aliyun DRDS
library-as-sharding, access external config service to determine paritioning rule;
works on JDBC layer;
DRDS : transparent and automatic scaling - just add machine
http://www.oschina.net/news/64312/aliyun-drds
https://yq.aliyun.com/articles/38883
DRDS features :
a) Join : if it‘s driven by a small table, broadcast the small table to each partition, and do local join - instead of join at the end
b) read/write segregation : policy-driven, DRDS determines which datanode is master and how to route read/write; policy can be updated on the fly; SQL hint to force certain node (e.g. master)
c) redundancy data copy;
d) distributed transaction (read-commit level)
MyCAT
Cobar-based, proxy-based;
client : MySQL CLI, JDBC etc.
Server: MySQL client protocol handler => SQL Parser / Router => SQL Executor => MySQL Instances...
Server / DataNode : Heartbeat check etc.
Google(Youtube): Vitess (vai-tess)
vttablet : a server sits in front of a MySQL database; connection pool to backend MySQL, row cache, rewrite/optimize SQL;
vtgate : light proxy which routes traffic from application to vttablet; health check of vttablet;
topology : metadata store (e.g. Zookeeper)
no transaction support (yet) : https://groups.google.com/forum/#!topic/vitess/e5N_YiODl14
ScaleBase
https://en.wikipedia.org/wiki/ScaleBase
2-phase commit and roll-back;
cross-node join and aggregations
MySQL Horizontal Scaling