当前位置 博文首页 > 纸上得来终觉浅,绝知此事要躬行:Mycat 开发调试环境配置-开启

    纸上得来终觉浅,绝知此事要躬行:Mycat 开发调试环境配置-开启

    作者:[db:作者] 时间:2021-07-29 09:40

    Mycat是 数据库分库分表中间件。mycat1.6分库分表特性只能选择其一,不能同时存在,对于特殊应用场景既需要分库有需要分表,这就需要修改mycat的源码来实现了。今次我们来准备一下Mycat的开发调试环境。官网参考地址:http://www.mycat.io/

    前期准备

    1、环境配置:需要准备jdk、maven、git、STS(eclipse);这些就不多说了。

    2、下载项目源码与配置mycat MySQL主备分库:

    mycat是master上安装的,local-mycat是本地代码启动服务连接。

    mycat项目已放至svn。

    项目配置

    mycat启动需要配置schema.xml、rule.xml、server.xml。

    修改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="t_user"   primaryKey="u_id" autoIncrement="true"   dataNode="dn1" rule="mod-single" />
    
                    <table name="t_service" primaryKey="s_id" autoIncrement="true"   dataNode="dn2"  rule="mod-single"/>
    
                   <table name="t_location" primaryKey="F_ID" autoIncrement="true"  dataNode="dn1,dn2" rule="mod-long" />
    
            </schema>
            <!-- <dataNode name="dn1$0-743" dataHost="localhost1" database="db$0-743"
                    /> -->
            <dataNode name="dn1" dataHost="localhost1" database="m" />
            <dataNode name="dn2" dataHost="localhost1" database="n" />
    
            <dataHost name="localhost1" maxCon="1000" minCon="10" balance="1"  writeType="0" dbType="mysql" dbDriver="native" switchType="1"  slaveThreshold="100">
                    <heartbeat>show slave status</heartbeat>
                    <!-- can have multi write hosts -->
                    <writeHost host="hostM1" url="10.0.0.129:3306" user="root"   password="123456">
                            <!-- can have multi read hosts -->
                            <readHost host="hostS2" url="10.0.0.128:3306" user="root" password="123456" />
                    </writeHost>
    
                    <!-- <writeHost host="hostM2" url="localhost:3316" user="root" password="123456"/> -->
            </dataHost>
    
    </mycat:schema>
    

    配置好逻辑表和数据库节点。

    修改rule.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- - - Licensed under the Apache License, Version 2.0 (the "License"); 
            - you may not use this file except in compliance with the License. - You 
            may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 
            - - Unless required by applicable law or agreed to in writing, software - 
            distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT 
            WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the 
            License for the specific language governing permissions and - limitations 
            under the License. -->
    <!DOCTYPE mycat:rule SYSTEM "rule.dtd">
    <mycat:rule xmlns:mycat="http://io.mycat/">
            <tableRule name="rule1">
                    <rule>
                            <columns>id</columns>
                            <algorithm>func1</algorithm>
                    </rule>
            </tableRule>
    
            <tableRule name="rule2">
                    <rule>
                            <columns>user_id</columns>
                            <algorithm>func1</algorithm>
                    </rule>
            </tableRule>
    
            <tableRule name="sharding-by-intfile">
                    <rule>
                            <columns>sharding_id</columns>
                            <algorithm>hash-int</algorithm>
                    </rule>
            </tableRule>
            <tableRule name="auto-sharding-long">
                    <rule>
                            <columns>id</columns>
                            <algorithm>rang-long</algorithm>
                    </rule>
            </tableRule>
            <tableRule name="mod-long">
                    <rule>
                            <columns>id</columns>
                            <algorithm>mod-long</algorithm>
                    </rule>
            </tableRule>
    
           <tableRule name="mod-single">
                    <rule>
                            <columns>id</columns>
                            <algorithm>mod-single</algorithm>
                    </rule>
            </tableRule>
    
            <tableRule name="sharding-by-murmur">
                    <rule>
                            <columns>id</columns>
                            <algorithm>murmur</algorithm>
                    </rule>
            </tableRule>
            <tableRule name="crc32slot">
                    <rule>
                            <columns>id</columns>
                            <algorithm>crc32slot</algorithm>
                    </rule>
            </tableRule>
            <tableRule name="latest-month-calldate">
                    <rule>
                            <columns>calldate</columns>
                            <algorithm>latestMonth</algorithm>
                    </rule>
            </tableRule>
    
            <tableRule name="auto-sharding-rang-mod">
                    <rule>
                            <columns>id</columns>
                            <algorithm>rang-mod</algorithm>
                    </rule>
            </tableRule>
    
            <tableRule name="jch">
                    <rule>
                            <columns>id</columns>
                            <algorithm>jump-consistent-hash</algorithm>
                    </rule>
            </tableRule>
    
            <function name="murmur"
                    class="io.mycat.route.function.PartitionByMurmurHash">
                    <property name="seed">0</property><!-- 默认是0 -->
                    <property name="count">2</property><!-- 要分片的数据库节点数量,必须指定,否则没法分片 -->
                    <property name="virtualBucketTimes">160</property><!-- 一个实际的数据库节点被映射为这么多虚拟节点,默认是160倍,也就是虚拟节点数是物理节点数的160倍 -->
            </function>
    
            <function name="crc32slot"
                              class="io.mycat.route.function.PartitionByCRC32PreSlot">
                    <property name="count">2</property><!-- 要分片的数据库节点数量,必须指定,否则没法分片 -->
            </function>
            <function name="hash-int"
                    class="io.mycat.route.function.PartitionByFileMap">
                    <property name="mapFile">partition-hash-int.txt</property>
            </function>
            <function name="rang-long"
                    class="io.mycat.route.function.AutoPartitionByLong">
                    <property name="mapFile">autopartition-long.txt</property>
            </function>
            <function name="mod-long" class="io.mycat.route.function.PartitionByMod">
                    <!-- how many data nodes -->
                    <property name="count">2</property>
            </function>
            <function name="mod-single" class="io.mycat.route.function.PartitionByMod">
                    <!-- how many data nodes -->
                    <property name="count">1</property>
            </function>
    
    
            <function name="func1" class="io.mycat.route.function.PartitionByLong">
                    <property name="partitionCount">8</property>
                    <property name="partitionLength">128</property>
            </function>
            <function name="latestMonth"
                    class="io.mycat.route.function.LatestMonthPartion">
                    <property name="splitOneDay">24</property>
            </function>
            <function name="partbymonth"
                    class="io.mycat.route.function.PartitionByMonth">
                    <property name="dateFormat">yyyy-MM-dd</property>
                    <property name="sBeginDate">2015-01-01</property>
            </function>
    
            <function name="rang-mod" class="io.mycat.route.function.PartitionByRangeMod">
                    <property name="mapFile">partition-range-mod.txt</property>
            </function>
    
            <function name="jump-consistent-hash" class="io.mycat.route.function.PartitionByJumpConsistentHash">
                    <property name="totalBuckets">3</property>
            </function>
    </mycat:rule>
    

    上面用以配置分片规则。

    修改server.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- - - Licensed under the Apache License, Version 2.0 (the "License"); 
    	- you may not use this file except in compliance with the License. - You 
    	may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 
    	- - Unless required by applicable law or agreed to in writing, software - 
    	distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT 
    	WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the 
    	License for the specific language governing permissions and - limitations 
    	under the License. -->
    <!DOCTYPE mycat:server SYSTEM "server.dtd">
    <mycat:server xmlns:mycat="http://io.mycat/">
    	<system>
    	<property name="useSqlStat">0</property>  <!-- 1为开启实时统计、0为关闭 -->
    	<property name="useGlobleTableCheck">0</property>  <!-- 1为开启全加班一致性检测、0为关闭 -->
    
    		<property name="sequnceHandlerType">2</property>
          <!--  <property name="useCompression">1</property>--> <!--1为开启mysql压缩协议-->
            <!--  <property name="fakeMySQLVersion">5.6.20</property>--> <!--设置模拟的MySQL版本号-->
    	<!-- <property name="processorBufferChunk">40960</property> -->
    	<!-- 
    	<property name="processors">1</property> 
    	<property name="processorExecutor">32</property> 
    	 -->
    		<!--默认为type 0: DirectByteBufferPool | type 1 ByteBufferArena-->
    		<property name="processorBufferPoolType">0</property>
    		<!--默认是65535 64K 用于sql解析时最大文本长度 -->
    		<!--<property name="maxStringLiteralLength">65535</property>-->
    		<!--<property name="sequnceHandlerType">0</property>-->
    		<!--<property name="backSocketNoDelay">1</property>-->
    		<!--<property name="frontSocketNoDelay">1</property>-->
    		<!--<property name="processorExecutor">16</property>-->
    		<!--
    			<property name="serverPort">8066</property> <property name="managerPort">9066</property> 
    			<property name="idleTimeout">300000</property> <property name="bindIp">0.0.0.0</property> 
    			<property name="frontWriteQueueSize">4096</property> <property name="processors">32</property> -->
    		<!--分布式事务开关,0为不过滤分布式事务,1为过滤分布式事务(如果分布式事务内只涉及全局表,则不过滤),2为不过滤分布式事务,但是记录分布式事务日志-->
    		<property name="handleDistributedTransactions">0</property>
    		
    			<!--
    			off heap for merge/order/group/limit      1开启   0关闭
    		-->
    		<property name="useOffHeapForMerge">1</property>
    
    		<!--
    			单位为m
    		-->
    		<property name="memoryPageSize">1m</property>
    
    		<!--
    			单位为k
    		-->
    		<property name="spillsFileBufferSize">1k</property>
    
    		<property name="useStreamOutput">0</property>
    
    		<!--
    			单位为m
    		-->
    		<property name="systemReserveMemorySize">384m</property>
    	</system>
    	
    	<!-- 全局SQL防火墙设置 -->
    	<!-- 
    	<firewall> 
    	   <whitehost>
    	      <host host="127.0.0.1" user="mycat"/>
    	      <host host="127.0.0.2" user="mycat"/>
    	   </whitehost>
           <blacklist check="false">
           </blacklist>
    	</firewall>
    	-->
    	
    	<user name="root">
    		<property name="password">123456</property>
    		<property name="schemas">TESTDB</property>
    		
    		<!-- 表级 DML 权限设置 -->
    		<!-- 		
    		<privileges check="false">
    			<schema name="TESTDB" dml="0110" >
    				<table name="tb01" dml="0000"></table>
    				<table name="tb02" dml="1111"></table>
    			</schema>
    		</privileges>		
    		 -->
    	</user>
    
    	<user name="user">
    		<property name="password">user</property>
    		<property name="schemas">TESTDB</property>
    		<property name="readOnly">true</property>
    	</user>
    
    </mycat:server>
    

    注:修改root对应的密码即可。

    启动MycatStartup.java

    运行Run as Application:

    2017-07-19 12:50:21,689 [INFO ][main] total resouces of dataHost localhost1 is :2  (io.mycat.backend.datasource.PhysicalDBPool:PhysicalDBPool.java:100) 
    2017-07-19 12:50:21,749 [INFO ][main] create layer cache pool TableID2DataNodeCache of type encache ,default cache size 10000 ,default expire seconds18000  (io.mycat.cache.CacheService:CacheService.java:125) 
    2017-07-19 12:50:21,750 [INFO ][main] create child Cache: TESTDB_ORDERS for layered cache TableID2DataNodeCache, size 50000, expire seconds 18000  (io.mycat.cache.DefaultLayedCachePool:DefaultLayedCachePool.java:80) 
    2017-07-19 12:50:23,129 [INFO ][main] dyna class load from D:\workspace-sts-3.8.4.RELEASE\mycat\src\main\catlet,and auto check for class file modified every 60 seconds  (io.mycat.config.classloader.DynaClassLoader:DynaClassLoader.java:34) 
    2017-07-19 12:50:23,129 [INFO ][main] ===============================================  (io.mycat.MycatServer:MycatServer.java:258) 
    2017-07-19 12:50:23,129 [INFO ][main] MyCat is ready to startup ...  (io.mycat.MycatServer:MycatServer.java:259) 
    2017-07-19 12:50:23,129 [INFO ][main] Startup processors ...,total processors:4,aio thread pool size:8    
     each process allocated socket buffer pool  bytes ,a page size:2097152  a page's chunk number(PageSize/ChunkSize) is:512  buffer page's number is:80  (io.mycat.MycatServer:MycatServer.java:271) 
    2017-07-19 12:50:23,129 [INFO ][main] sysconfig params:SystemConfig [processorBufferLocalPercent=100, frontSocketSoRcvbuf=1048576, frontSocketSoSndbuf=4194304, backSocketSoRcvbuf=4194304, backSocketSoSndbuf=1048576, frontSocketNoDelay=1, backSocketNoDelay=1, maxStringLiteralLength=65535, frontWriteQueueSize=2048, bindIp=0.0.0.0, serverPort=8066, managerPort=9066, charset=utf8, processors=4, processorExecutor=8, timerExecutor=2, managerExecutor=2, idleTimeout=1800000, catletClassCheckSeconds=60, sqlExecuteTimeout=300, processorCheckPeriod=1000, dataNodeIdleCheckPeriod=300000, dataNodeHeartbeatPeriod=10000, clusterHeartbeatUser=_HEARTBEAT_USER_, clusterHeartbeatPass=_HEARTBEAT_PASS_, clusterHeartbeatPeriod=5000, clusterHeartbeatTimeout=10000, clusterHeartbeatRetry=10, txIsolation=3, parserCommentVersion=50148, sqlRecordCount=10, bufferPoolPageSize=2097152, bufferPoolChunkSize=4096, bufferPoolPageNumber=80, maxResultSet=524288, bigResultSizeSqlCount=10, bufferUsagePercent=80, flowControlRejectStrategy=0, clearBigSqLResultSetMapMs=600000, defaultMaxLimit=100, sequnceHandlerType=2, sqlInterceptor=io.mycat.server.interceptor.impl.DefaultSqlInterceptor, sqlInterceptorType=select, sqlInterceptorFile=D:\workspace-sts-3.8.4.RELEASE\mycat/logs/sql.txt, mutiNodeLimitType=0, mutiNodePatchSize=100, defaultSqlParser=druidparser, usingAIO=0, packetHeaderSize=4, maxPacketSize=16777216, mycatNodeId=1]  (io.mycat.MycatServer:MycatServer.java:272) 
    2017-07-19 12:50:23,243 [INFO ][main] useOffHeapForMerge = 1  (io.mycat.memory.MyCatMemory:MyCatMemory.java:53) 
    2017-07-19 12:50:23,243 [INFO ][main] memoryPageSize = 1m  (io.mycat.memory.MyCatMemory:MyCatMemory.java:54) 
    2017-07-19 12:50:23,243 [INFO ][main] spillsFileBufferSize = 1k  (io.mycat.memory.MyCatMemory:MyCatMemory.java:55) 
    2017-07-19 12:50:23,243 [INFO ][main] useStreamOutput = 0  (io.mycat.memory.MyCatMemory:MyCatMemory.java:56) 
    2017-07-19 12:50:23,243 [INFO ][main] systemReserveMemorySize = 384m  (io.mycat.memory.MyCatMemory:MyCatMemory.java:57) 
    2017-07-19 12:50:23,263 [INFO ][main] totalNetWorkBufferSize = 160MB  (io.mycat.memory.MyCatMemory:MyCatMemory.java:58) 
    2017-07-19 12:50:23,263 [INFO ][main] dataNodeSortedTempDir = D:\workspace-sts-3.8.4.RELEASE\mycat  (io.mycat.memory.MyCatMemory:MyCatMemory.java:59) 
    2017-07-19 12:50:23,279 [INFO ][main] mycat.memory.offHeap.size: 1010MB  (io.mycat.memory.MyCatMemory:MyCatMemory.java:122) 
    2017-07-19 12:50:23,295 [INFO ][main] using nio network handler   (io.mycat.MycatServer:MycatServer.java:373) 
    2017-07-19 12:50:24,659 [INFO ][main] $_MyCatManager is started and listening on 9066  (io.mycat.MycatServer:MycatServer.java:389) 
    2017-07-19 12:50:24,659 [INFO ][main] $_MyCatServer is started and listening on 8066  (io.mycat.MycatServer:MycatServer.java:393) 
    2017-07-19 12:50:24,660 [INFO ][main] ===============================================  (io.mycat.MycatServer:MycatServer.java:395) 
    2017-07-19 12:50:24,660 [INFO ][main] Initialize dataHost ...  (io.mycat.MycatServer:MycatServer.java:399) 
    2017-07-19 12:50:24,660 [INFO ][main] init backend myqsl source ,create connections total 10 for hostM1 index :0  (io.mycat.backend.datasource.PhysicalDBPool:PhysicalDBPool.java:294) 
    2017-07-19 12:50:24,661 [INFO ][main] no ilde connection in pool,create new connection for hostM1 of schema n  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:24,662 [INFO ][main] no ilde connection in pool,create new connection for hostM1 of schema m  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:24,662 [INFO ][main] no ilde connection in pool,create new connection for hostM1 of schema n  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:24,662 [INFO ][main] no ilde connection in pool,create new connection for hostM1 of schema m  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:24,665 [INFO ][main] no ilde connection in pool,create new connection for hostM1 of schema n  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:24,665 [INFO ][main] no ilde connection in pool,create new connection for hostM1 of schema m  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:24,666 [INFO ][main] no ilde connection in pool,create new connection for hostM1 of schema n  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:24,666 [INFO ][main] no ilde connection in pool,create new connection for hostM1 of schema m  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:24,666 [INFO ][main] no ilde connection in pool,create new connection for hostM1 of schema n  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:24,666 [INFO ][main] no ilde connection in pool,create new connection for hostM1 of schema m  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:25,547 [INFO ][$_NIOREACTOR-3-RW] connected successfuly MySQLConnection [id=7, lastTime=1500439825547, user=root, schema=m, old shema=m, borrowed=true, fromSlaveDB=false, threadId=26, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67) 
    2017-07-19 12:50:25,547 [INFO ][$_NIOREACTOR-1-RW] connected successfuly MySQLConnection [id=1, lastTime=1500439825547, user=root, schema=m, old shema=m, borrowed=true, fromSlaveDB=false, threadId=24, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67) 
    2017-07-19 12:50:25,548 [INFO ][$_NIOREACTOR-2-RW] connected successfuly MySQLConnection [id=6, lastTime=1500439825547, user=root, schema=n, old shema=n, borrowed=true, fromSlaveDB=false, threadId=25, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67) 
    2017-07-19 12:50:25,793 [INFO ][$_NIOREACTOR-2-RW] connected successfuly MySQLConnection [id=2, lastTime=1500439825793, user=root, schema=m, old shema=m, borrowed=true, fromSlaveDB=false, threadId=30, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67) 
    2017-07-19 12:50:25,793 [INFO ][$_NIOREACTOR-3-RW] connected successfuly MySQLConnection [id=3, lastTime=1500439825793, user=root, schema=m, old shema=m, borrowed=true, fromSlaveDB=false, threadId=28, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67) 
    2017-07-19 12:50:25,795 [INFO ][$_NIOREACTOR-0-RW] connected successfuly MySQLConnection [id=8, lastTime=1500439825795, user=root, schema=n, old shema=n, borrowed=true, fromSlaveDB=false, threadId=31, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67) 
    2017-07-19 12:50:25,795 [INFO ][$_NIOREACTOR-1-RW] connected successfuly MySQLConnection [id=5, lastTime=1500439825795, user=root, schema=m, old shema=m, borrowed=true, fromSlaveDB=false, threadId=27, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67) 
    2017-07-19 12:50:25,796 [INFO ][$_NIOREACTOR-0-RW] connected successfuly MySQLConnection [id=4, lastTime=1500439825796, user=root, schema=n, old shema=n, borrowed=true, fromSlaveDB=false, threadId=29, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67) 
    2017-07-19 12:50:25,808 [INFO ][$_NIOREACTOR-1-RW] connected successfuly MySQLConnection [id=9, lastTime=1500439825808, user=root, schema=n, old shema=n, borrowed=true, fromSlaveDB=false, threadId=32, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67) 
    2017-07-19 12:50:25,810 [INFO ][$_NIOREACTOR-2-RW] connected successfuly MySQLConnection [id=10, lastTime=1500439825810, user=root, schema=n, old shema=n, borrowed=true, fromSlaveDB=false, threadId=33, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67) 
    2017-07-19 12:50:25,876 [INFO ][main] init result :finished 10 success 10 target count:10  (io.mycat.backend.datasource.PhysicalDBPool:PhysicalDBPool.java:319) 
    2017-07-19 12:50:25,876 [INFO ][main] localhost1 index:0 init success  (io.mycat.backend.datasource.PhysicalDBPool:PhysicalDBPool.java:265) 
    2017-07-19 12:50:25,876 [INFO ][main] save DataHost index  localhost1 cur index 0  (io.mycat.MycatServer:MycatServer.java:557) 
    MyCAT Server startup successfully. see logs in logs/mycat.log
    2017-07-19 12:50:28,061 [INFO ][Timer1] create connections ,because idle connection not enough ,cur is 0, minCon is 10 for hostS2  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:299) 
    2017-07-19 12:50:28,076 [INFO ][Timer1] no ilde connection in pool,create new connection for hostS2 of schema n  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413) 
    2017-07-19 12:50:28,293 [INFO ][$_NIOREACTOR-3-RW] connectionAcquired MySQLConnection [id=11, lastTime=1500439828275, user=root, schema=n, old shema=n, borrowed=false, fromSlaveDB=true, threadId=22, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.128, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.NewConnectionRespHandler:NewConnectionRespHandler.java:45) 
    2017-07-19 12:50:28,319 [INFO ][$_NIOREACTOR-2-RW] connectionAcquired MySQLConnection [id=14, lastTime=1500439828316, user=root, schema=m, old shema=m, borrowed=false, fromSlaveDB=true, threadId=25, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.128, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.NewConnectionRespHandler:NewConnectionRespHandler.java:45) 
    2017-07-19 12:50:28,322 [INFO ][$_NIOREACTOR-0-RW] connectionAcquired MySQLConnection [id=12, lastTime=1500439828316, user=root, schema=n, old shema=n, borrowed=false, fromSlaveDB=true, threadId=23, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.128, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.NewConnectionRespHandler:NewConnectionRespHandler.java:45) 
    2017-07-19 12:53:16,500 [INFO ][$_NIOREACTOR-3-RW] ServerConnection [id=1, schema=null, host=192.168.1.4, user=root,txIsolation=3, autocommit=true, schema=null]'root' login success  (io.mycat.net.handler.FrontendAuthenticator:FrontendAuthenticator.java:194) 
    2017-07-19 12:53:17,663 [INFO ][$_NIOREACTOR-3-RW] close connection,reason:quit cmd ,ServerConnection [id=1, schema=null, host=192.168.1.4, user=root,txIsolation=3, autocommit=true, schema=null]  (io.mycat.net.AbstractConnection:AbstractConnection.java:508) 
    2017-07-19 12:53:20,226 [INFO ][$_NIOREACTOR-0-RW] ServerConnection [id=2, schema=null, host=192.168.1.4, user=root,txIsolation=3, autocommit=true, schema=null]'root' login success  (io.mycat.net.handler.FrontendAuthenticator:FrontendAuthenticator.java:194) 
    2017-07-19 12:53:21,555 [INFO ][$_NIOREACTOR-1-RW] ServerConnection [id=3, schema=null, host=192.168.1.4, user=root,txIsolation=3, autocommit=true, schema=null]'root' login success  (io.mycat.net.handler.FrontendAuthenticator:FrontendAuthenticator.java:194) 
    2017-07-19 12:53:24,426 [INFO ][$_NIOREACTOR-1-RW] close connection,reason:quit cmd ,ServerConnection [id=3, schema=TESTDB, host=192.168.1.4, user=root,txIsolation=3, autocommit=true, schema=TESTDB]  (io.mycat.net.AbstractConnection:AbstractConnection.java:508) 
    2017-07-19 12:53:24,427 [INFO ][$_NIOREACTOR-0-RW] close connection,reason:quit cmd ,ServerConnection [id=2, schema=null, host=192.168.1.4, user=root,txIsolation=3, autocommit=true, schema=null]  (io.mycat.net.AbstractConnection:AbstractConnection.java:508) 
    2017-07-19 12:53:25,222 [INFO ][$_NIOREACTOR-2-RW] ServerConnection [id=4, schema=null, host=192.168.1.4, user=root,txIsolation=3, autocommit=true, schema=null]'root' login success  (io.mycat.net.handler.FrontendAuthenticator:FrontendAuthenticator.java:194) 
    2017-07-19 12:53:26,713 [INFO ][$_NIOREACTOR-3-RW] ServerConnection [id=5, schema=null, host=192.168.1.4, user=root,txIsolation=3, autocommit=true, schema=null]'root' login success  (io.mycat.net.handler.FrontendAuthenticator:FrontendAuthenticator.java:194) 
    2017-07-19 12:55:28,039 [INFO ][Timer0] create connections ,because idle connection not enough ,cur is 5, minCon is 10 for hostM1  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:299) 
    2017-07-19 12:55:28,040 [INFO ][Timer0] create connections ,because idle connection not enough ,cur is 4, minCon is 10 for hostS2  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:299) 
    2017-07-19 12:55:28,143 [INFO ][$_NIOREACTOR-0-RW] connectionAcquired MySQLConnection [id=15, lastTime=1500440128137, user=root, schema=m, old shema=m, borrowed=false, fromSlaveDB=true, threadId=26, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.128, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.NewConnectionRespHandler:NewConnectionRespHandler.java:45) 
    2017-07-19 12:55:28,153 [INFO ][$_NIOREACTOR-2-RW] connectionAcquired MySQLConnection [id=17, lastTime=1500440128137, user=root, schema=n, old shema=n, borrowed=false, fromSlaveDB=true, threadId=27, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.128, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.NewConnectionRespHandler:NewConnectionRespHandler.java:45) 
    2017-07-19 12:55:28,172 [INFO ][$_NIOREACTOR-1-RW] connectionAcquired MySQLConnection [id=16, lastTime=1500440128157, user=root, schema=n, old shema=n, borrowed=false, fromSlaveDB=false, threadId=34, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.NewConnectionRespHandler:NewConnectionRespHandler.java:45) 
    2017-07-19 13:00:28,040 [INFO ][Timer0] too many ilde cons ,close some for datasouce  hostM1  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:280) 
    2017-07-19 13:00:28,043 [INFO ][Timer0] close connection,reason:too many idle con ,MySQLConnection [id=1, lastTime=1500440128058, user=root, schema=m, old shema=m, borrowed=false, fromSlaveDB=false, threadId=24, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.net.AbstractConnection:AbstractConnection.java:508) 
    2017-07-19 13:00:28,044 [INFO ][Timer0] create connections ,because idle connection not enough ,cur is 5, minCon is 10 for hostS2  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:299) 
    2017-07-19 13:00:28,063 [INFO ][$_NIOREACTOR-3-RW] connectionAcquired MySQLConnection [id=18, lastTime=1500440428058, user=root, schema=n, old shema=n, borrowed=false, fromSlaveDB=true, threadId=28, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.128, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.NewConnectionRespHandler:NewConnectionRespHandler.java:45) 
    2017-07-19 13:05:28,044 [INFO ][Timer0] create connections ,because idle connection not enough ,cur is 6, minCon is 10 for hostM1  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:299) 
    2017-07-19 13:05:28,044 [INFO ][Timer0] create connections ,because idle connection not enough ,cur is 5, minCon is 10 for hostS2  (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:299) 
    2017-07-19 13:05:28,119 [INFO ][$_NIOREACTOR-0-RW] connectionAcquired MySQLConnection [id=19, lastTime=1500440728101, user=root, schema=n, old shema=n, borrowed=false, fromSlaveDB=false, threadId=35, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.129, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.NewConnectionRespHandler:NewConnectionRespHandler.java:45) 
    2017-07-19 13:05:28,120 [INFO ][$_NIOREACTOR-1-RW] connectionAcquired MySQLConnection [id=20, lastTime=1500440728101, user=root, schema=n, old shema=n, borrowed=false, fromSlaveDB=true, threadId=29, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=10.0.0.128, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]  (io.mycat.backend.mysql.nio.handler.NewConnectionRespHandler:NewConnectionRespHandler.java:45)