For sub-library sub-table, the concrete in two ways:
垂直拆分和水平拆分. The vertical split is mainly about the refinement and independence of the business, which is closely related to the business. So this article only discusses more general horizontal splits.
范围区分(range): Shard by month\by district\by other special attribute dimensions
预定义范围: Estimate how much data capacity there is, and allocate the range of data, 0-100->A 101-200->B
取模 Hash: Perform modulo operation on the specified field to match the corresponding library and table.
There are many middleware for sub-database and sub-table, Shardingsphere, Tddl, MyCat, cobar. In terms of architecture, there are two main types:
JDBC应用模式It is fragmentation based on the client, and the client
Sqldetermines the specific SQL server to be executed according to the rules and rules. Representative has
Advantages of JDBC application mode:
Proxy模式Agent model is based on
MySQLdoing one forwarding agent, the agent is to distribute specific to the SQL server according to the rules.