2.1.13 配置检查命令dryrun

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

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

<?xml version="1.0"?>
<!--
  ~ Copyright (C) 2016-2018 ActionTech.
  ~ License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher.
  -->

<!DOCTYPE dble:schema SYSTEM "schema.dtd">
<dble:schema xmlns:dble="http://dble.cloud/">
    <schema name="testdb" sqlMaxLimit="100" >
        <table name="sharding_two_node" dataNode="dn1,dn2" rule="two_node_hash"/>
        <table name="sharding_two_node2" dataNode="dn1,dn2" rule="two_node_hash"/>
        <table name="sharding_two_node3" dataNode="dn1,dn2" rule="two_node_hash"/>
        <table name="sharding_four_node" dataNode="dn1,dn2,dn3,dn4" rule="four_node_hash" />
        <table name="test_table" type="global" dataNode="dn$1-2"/>
        <table name="a_test" primaryKey="id" dataNode="dn1,dn2,dn3,dn4" rule="four_node_hash" />
        <table name="a_order" primaryKey="id" dataNode="dn1,dn2,dn3,dn4" rule="four_node_hash" />
        <table name="test_shard" dataNode="dn1,dn2,dn3,dn4" rule="four_node_hash"/>
        <table name="test_global" dataNode="dn1,dn2,dn3,dn4" type="global"/>

        <table name="sbtest1" primaryKey="id" dataNode="dn1,dn2,dn3,dn4" rule="four_node_hash" />

    </schema>

    <schema name="nosharding_test" sqlMaxLimit="100" dataNode="dn5">
    </schema>
    <dataNode name="dn1" dataHost="dh1" database="ares_test" />
    <dataNode name="dn2" dataHost="dh2" database="dble_test" />
    <dataNode name="dn3" dataHost="dh1" database="mycat_test" />
    <dataNode name="dn4" dataHost="dh2" database="mycat_test" />
    <dataNode name="dn5" dataHost="dh1" database="nosharding" />
    <dataNode name="dn8" dataHost="dh1" database="xxxoooxxx" />
    <dataNode name="dn9" dataHost="dh1" database="xxxoooxxx2" />
    <dataHost name="dh1" maxCon="10" minCon="1" balance="2"
              switchType="-1"  slaveThreshold="100"   tempReadHostAvailable="0">
        <heartbeat>show slave status</heartbeat>
        <writeHost host="hostM1" url="10.186.xx.xxx:3306" user="action"
                   password="action" > 
        </writeHost>

    </dataHost>

    <dataHost name="dh2" maxCon="10" minCon="1" balance="3"
              switchType="2" slaveThreshold="100" >
        <heartbeat>show slave status</heartbeat>
        <writeHost host="hostM2" url="10.186.xx.xxx:3306" user="qrep"
                   password="qrep" >
        </writeHost>
    </dataHost> 

</dble:schema>

dryrun结果如下:

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

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

results matching ""

    No results matching ""