多个库,每个库都有多张拆分表,比如order在每个数据库都拆分order1,order2怎么样配置

来源:5-10 ER分片

茶客舍

2019-04-19

多个库,每个库都有多张拆分表,比如order在每个数据库都拆分order1,order2怎么样配置

写回答

1回答

sqlercn

2019-04-19

MyCAT对一个库下的分表的支持目前并不是太好,如果一定要用的话可以在schema.xml中使用subtables属性进行配置,参考如下:

 <schema name="TESTDB" checkSQLschema="false" sqlMaxLimit="100"  >
 <!-- 与mysql数据库中的表名对应 subTables="t_order$1-3"是配置分表的 对应mysql  order1, order2, order3表的        primaryKey="id" 是主键id
        -->
 <table name="order" primaryKey="id" autoIncrement="true"  subTables="order$1-3"  dataNode="dn1" rule="mod-long"  >
 </table>
 <table name="user" primaryKey="id" autoIncrement="true"  dataNode="dn1" />
 </schema>

0
0

MyCAT+MySQL搭建高可用企业级数据库集群

国内顶级DBA亲授,精讲企业级MyCAT应用

816 学习 · 223 问题

查看课程