2.1.13 配置检查命令dryrun

背景;当我们修改配置之后并且reload之前,可以通过dryrun来检查配置的正确性。

举例,当这样一个sharding.xml 准备reload时,先观察dryrun结果: sharding.xml:

<?xml version="1.0"?>
<dble:sharding xmlns:dble="http://dble.cloud/">
    <schema name="testdb" sqlMaxLimit="100" >
        <shardingTable name="sharding_two_node" shardingNode="dn1,dn2" shardingColumn="id" function="two-long" />
        <shardingTable name="sharding_two_node2" shardingNode="dn1,dn2" shardingColumn="id" function="two-long" />
        <shardingTable name="sharding_two_node3" shardingNode="dn1,dn2" shardingColumn="id" function="two-long" />
        <shardingTable name="sharding_four_node" shardingNode="dn1,dn2,dn3,dn4" shardingColumn="id" function="rule_simple"  />
        <globalTable name="test_table"shardingNode="dn$1-2"/>
        <shardingTable name="a_test" shardingNode="dn1,dn2,dn3,dn4" shardingColumn="id" function="rule_simple"  />
        <shardingTable name="a_order" shardingNode="dn1,dn2,dn3,dn4" shardingColumn="id" function="rule_simple"  />
        <shardingTable name="test_shard" shardingNode="dn1,dn2,dn3,dn4" shardingColumn="id" function="rule_simple" />
        <globalTable name="test_global" shardingNode="dn1,dn2,dn3,dn4"/>
        <shardingTable name="sbtest1" shardingNode="dn1,dn2,dn3,dn4" shardingColumn="id" function="rule_simple"  />
    </schema>
    <schema name="nosharding_test" sqlMaxLimit="100" shardingNode="dn5">
    </schema>
    <shardingNode name="dn1" dbGroup="dh1" database="ares_test" />
    <shardingNode name="dn2" dbGroup="dh2" database="dble_test" />
    <shardingNode name="dn3" dbGroup="dh1" database="dble_test" />
    <shardingNode name="dn4" dbGroup="dh2" database="dble_test" />
    <shardingNode name="dn5" dbGroup="dh1" database="nosharding" />
    <shardingNode name="dn8" dbGroup="dh1" database="xxxoooxxx" />

<function name="rule_simple" class="Hash">
        <property name="partitionCount">4</property>
        <property name="partitionLength">1</property>
    </function>
</dble:sharding>
<function class="Hash" name="two-long">
        <property name="partitionCount">2</property>
        <property name="partitionLength">1</property>
    </function>

dryrun结果如下:

mysql> dryrun;
+------+---------+-----------------------------+
| TYPE | LEVEL   | DETAIL                      |
+------+---------+-----------------------------+
| Xml  | WARNING | shardingNode dn9 is useless |
| Xml  | WARNING | shardingNode dn8 is useless |
+------+---------+-----------------------------+
2 rows in set (0.58 sec)

列名含义:
TYPE: 错误类型,比如XML表示xml配置错误,BACKEND表示后端连接错误
LEVAL:错误级别:分为WARNNING 和ERROR表,一般来说WARNNING错误不影响启动和使用,但需要注意。
DETAIL :错误详情

results matching ""

    No results matching ""