schema.xml:
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<schema name="TESTDB" checkSQLschema="false" sqlMaxLimit="100" >
<table name="tb_user" dataNode="dn1,dn2" rule="my_mod_rule"/>
</schema>
<dataNode name="dn1" dataHost="host1" database="jeesun_user" />
<dataNode name="dn2" dataHost="host2" database="jeesun_user" />
<dataHost name="host1" maxCon="1000" minCon="10" balance="0"
writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
<heartbeat>select user()</heartbeat>
<!-- can have multi write hosts -->
<writeHost host="hostM1" url="192.168.31.52:3306" user="root"
password="root12">
</writeHost>
</dataHost>
<dataHost name="host2" maxCon="1000" minCon="10" balance="0"
writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
<heartbeat>select user()</heartbeat>
<!-- can have multi write hosts -->
<writeHost host="hostM1" url="192.168.31.52:3308" user="root"
password="root12">
</writeHost>
</dataHost>
</mycat:schema>
rule.xml:
<tableRule name="my_mod_rule">
<rule>
<columns>user_id</columns>
<algorithm>my_mod-long</algorithm>
</rule>
</tableRule>
<function name="my_mod-long" class="io.mycat.route.function.PartitionByMod">
<!-- how many data nodes -->
<property name="count">2</property>
</function>