rule.xml配置
# rule.xml配置
Mycat分片规则定义配置文件。
# tableRule标签
分片规则定义。
<tableRule name="tb_order_rule">
<rule>
<columns>user_id</columns>
<algorithm>partitionByOrderFunc</algorithm>
</rule>
</tableRule>
属性名 | 说明 |
---|---|
name | 指定唯一的名字,用于标识不同的表规则 |
columns | 指定要拆分的列名字 |
algorithm | 使用 function 标签中的 name 属性,连接表规则和具体路由算法。 |
# function标签
路由算法定义
<function name="partitionByOrderFunc" class="io.mycat.route.function.PartitionByMod">
<property name="count">2</property>
</function>
属性名 | 说明 |
---|---|
name | 指定算法的名字 |
class | 制定路由算法具体的类的全类名。 |
property | 为具体算法需要用到的一些属性 |
上次更新: 5/30/2023, 11:42:20 PM