The idea of distributed database middleware

DB PROXY function

The idea of ​​distributed database middleware

0 Owns the number of shard databases and the main database (non-sharded)

1 The front-end SQL requires plain text, not bind variable, and the client HASH becomes SQLID

2 Front-end MAXCONN limit, MAXPACKESIZE

3 Return to the front end RETURN PACKAGE SIZE+RETURN ROWS

4 Cache SQLID routing path

5 Route analysis SQL clear text to determine the routing path and store it in the cache

6 Fragmented tables have global tables, single-sharded tables, master-slave tables

7 Fragmentation table algorithm: LIST HASH, RANGE, DATETIME

8 The tables after FROM in the SQL statement must all be fragmented tables. If there is a non-sharded table, it will not be fragmented and routed to the main database for execution.

10 Global transaction table, this is the solution to the global table and the fully fragmented transaction table. When a transaction needs to be executed in the full shard library, it is registered in the global transaction table.

当所有分片事务执行成功则向下发COMMIT;部分失败则失败向成功的分片库发ROLLBACK命令。

11 Asynchronous log

除了全局表外分片表的DML需要同步到主库,DBRROXY会生产SHARDING_TO_MASTER_ASYN.LOG

When the DML of the shard table is executed in the main library, then it needs to be synchronized to the shard table. DBPROXY will produce MASTER_TO_SHARDING_ASYN.LOG

Need to set the delay time

12 DDL will be regarded as a global transaction ONLINE DDL

13 Consistent read of the transaction requires the application to lock the data first SELECT * FROM T FOR UPDATE;

14 Supports logical data nodes. The fragment table is stored on the logical node. There can be multiple logical nodes on the physical data node.

15 Fragmented table redistribution is based on logical nodes

16 Supports the overall migration of logical nodes to different physical nodes.

17 The physical node does not support master-slave switching and requires KEEP AVLIE (ORACLE RAC SCAN IP OR VIP)

18 Support physical node read-write separation and load balancing from the library.

19 TABLE NAME TUSER_G(M,S,N)_LIST(HASH,RANGE)_001(UNKONW)

Guess you like

Origin blog.51cto.com/15080028/2643028