深入MySQL--开源组件-DBLE详解3
schema.xmlschema.xml是最主要的配置项,我们将users用户表按照取模的方式平均拆分到了MySQL A和MySQL B两个数据数据库实例上,
详细请看配置文件:
<?xml version="1.0"?>
<!DOCTYPE dble:schema SYSTEM "schema.dtd">
<dble:schema xmlns:dble="http://dble.cloud/">
<schema name="testdb">
<table name="users" primaryKey="ID"dataNode="dn1,dn2" rule="sharding-by-mod2" />
</schema>
<!-- 分片配置 -->
<dataNode name="dn1" dataHost="Group1" database="testdb"/>
<dataNode name="dn2" dataHost="Group2" database="testdb"/>
<!-- 物理数据库配置 -->
<dataHost name="Group1" maxCon="1000" minCon="10" balance="0" switchType="1" slaveThreshold="100">
<heartbeat>show slave status</heartbeat>
<writeHost host="MySQLA" url="172.16.3.1:14014" user="test" password="password"/>
</dataHost>
<dataHost name="Group2" maxCon="1000" minCon="10" balance="0" switchType="1" slaveThreshold="100">
<heartbeat>show slave status</heartbeat>
<writeHost host="MySQLA" url="172.16.3.1:14015" user="test" password="password"/>
</dataHost>
</dble:schema>
参数说明
**** Hidden Message *****
页:
[1]