rule.xml 882 Bytes
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cobar:rule SYSTEM "rule.dtd">
<cobar:rule xmlns:cobar="http://cobar.alibaba.com/">

    <!-- 路由规则定义,定义什么表,什么字段,采用什么路由算法 -->
    <tableRule name="rule_promt">
        <rule>
            <columns>uid</columns>
            <algorithm><![CDATA[ rule_func(${uid}) ]]></algorithm>
        </rule>
    </tableRule>

    <tableRule name="rule_order">
        <rule>
            <columns>uid</columns>
            <algorithm><![CDATA[ rule_func(${uid}) ]]></algorithm>
        </rule>
    </tableRule>

    <!-- 路由函数定义 -->
    <function name="rule_func" class="com.alibaba.cobar.route.function.PartitionByLong">
        <property name="partitionCount">4</property>
        <property name="partitionLength">256</property>
    </function>

</cobar:rule>