• mycat 使用之一 setup


    os:centos 7.4
    jdk: 1.8.0_131
    mysql: 5.7.22
    mycat: 1.6.5

    node1 节点 安装 mycat 1.6.5
    node2、node3 节点安装 mysql 5.7.22

    mycat使用的是java语言开发,虽然可以跨平台使用,但是生产环境一般的都是linux。

    环境检查

    # lsb_release -a
    LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
    Distributor ID: CentOS
    Description:    CentOS Linux release 7.4.1708 (Core) 
    Release:    7.4.1708
    Codename:   Core
    
    # which java
    /usr/bin/java
    # java -version
    openjdk version "1.8.0_131"
    OpenJDK Runtime Environment (build 1.8.0_131-b12)
    OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
    
    # cat /etc/hosts
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    
    192.168.56.101 node1
    192.168.56.102 node2
    192.168.56.103 node3
    

    node1 节点安装mysql 5.7 客户端

    下载了 mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar

    注意centos 7 默认安装的是 mariadb ,使用 rpm -e –nodeps mariadb-libs 卸载
    安装除mysql-community-server、mysql-community-server-minimal、mysql-community-test外的rpm。

    # cd /tmp/mysql
    # tar -xvf mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar
    # rm -f ./mysql-community-server-5.7.22-1.el7.x86_64.rpm
    # rm -f ./mysql-community-server-minimal-5.7.22-1.el7.x86_64.rpm
    # rm -f ./mysql-community-test-5.7.22-1.el7.x86_64.rpm
    # rpm -ivh ./mysql-community*.rpm
    
    # rpm -qa |grep -i mysql
    mysql-community-libs-compat-5.7.22-1.el7.x86_64
    mysql-community-embedded-5.7.22-1.el7.x86_64
    mysql-community-common-5.7.22-1.el7.x86_64
    mysql-community-minimal-debuginfo-5.7.22-1.el7.x86_64
    mysql-community-client-5.7.22-1.el7.x86_64
    mysql-community-devel-5.7.22-1.el7.x86_64
    mysql-community-embedded-compat-5.7.22-1.el7.x86_64
    mysql-community-embedded-devel-5.7.22-1.el7.x86_64
    mysql-community-libs-5.7.22-1.el7.x86_64
    

    node2、node3 节点安装 mysql 5.7服务器

    注意centos 7 默认安装的是 mariadb-libs ,使用 rpm -e –nodeps mariadb-libs 卸载

    # cd /tmp/mysql
    # tar -xvf mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar
    # rm -f ./mysql-community-server-minimal-5.7.22-1.el7.x86_64.rpm
    # rpm -ivh ./mysql-community*.rpm
    
    # rpm -qa |grep -i mysql
    mysql-community-libs-compat-5.7.22-1.el7.x86_64
    mysql-community-embedded-5.7.22-1.el7.x86_64
    mysql-community-client-5.7.22-1.el7.x86_64
    mysql-community-test-5.7.22-1.el7.x86_64
    mysql-community-devel-5.7.22-1.el7.x86_64
    mysql-community-libs-5.7.22-1.el7.x86_64
    mysql-community-embedded-compat-5.7.22-1.el7.x86_64
    mysql-community-embedded-devel-5.7.22-1.el7.x86_64
    mysql-community-server-5.7.22-1.el7.x86_64
    mysql-community-common-5.7.22-1.el7.x86_64
    mysql-community-minimal-debuginfo-5.7.22-1.el7.x86_64
    

    启动mysql service后,创建数据库,创建用户。

    mysql> CREATE USER 'peiyb'@'192.168.56.101' IDENTIFIED BY 'peiybpeiyb';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> CREATE DATABASE peiybdb;
    Query OK, 1 row affected (0.01 sec)
    
    mysql> GRANT ALL PRIVILEGES ON peiybdb.* to 'peiyb'@'192.168.56.101';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    

    下载 mycat

    node1 节点下载 mycat
    1、github,貌似很久没有更新了
    https://github.com/MyCATApache/Mycat-download
    https://github.com/MyCATApache/Mycat-Server.git

    2、http://dl.mycat.io/
    本次采用这种方式下载

    Index of /
    
    ../
    1.6-RELEASE/                                       28-Oct-2016 12:56                   -
    1.6.5/                                             22-Jan-2018 14:07                   -
    1.6.5-BETA/                                        08-Oct-2017 09:06                   -
    1.7-BETA/                                          16-Apr-2017 05:54                   -
    2.0-dev/                                           02-Jan-2017 07:24                   -
    mycat-web-1.0/                                     02-Jan-2017 07:40                   -
    yum/                                               18-May-2016 02:51                   -
    Mycat-server-1.4-beta-20150604171601-linux.tar.gz  27-Jun-2015 10:09             7663894
    apache-maven-3.3.3-bin.tar.gz                      27-Jun-2015 10:09             8042383
    apache-tomcat-7.0.62.tar.gz                        27-Jun-2015 10:09             8824528
    jdk-7u79-linux-x64.tar.gz                          27-Jun-2015 10:09           153512879
    jdk-8u20-linux-x64.tar.gz                          27-Jun-2015 10:09           160872342
    phpMyAdmin-4.4.9-all-languages.tar.gz              27-Jun-2015 10:09             9352049
    probe-2.3.3.zip                                    27-Jun-2015 10:09             7957290
    toolset.sh                                         26-Oct-2015 05:03               16015
    zookeeper-3.4.6.tar.gz                             27-Jun-2015 10:09            17699306

    安装

    # mkdir -p /usr/mycat-1.6.5
    # cd /usr/mycat-1.6.5/
    # wget http://dl.mycat.io/1.6.5/Mycat-server-1.6.5-release-20180122220033-linux.tar.gz
    # tar -zxvf ./Mycat-server-1.6.5-release-20180122220033-linux.tar.gz 
    # ls -l
    total 17072
    drwxr-xr-x 7 root root       85 Jun 19 23:34 mycat
    -rw-r--r-- 1 root root 17480035 Jan 22 22:07 Mycat-server-1.6.5-release-20180122220033-linux.tar.gz
    
    # rm -f ./Mycat-server-1.6.5-release-20180122220033-linux.tar.gz 
    # cd mycat
    # mv ./* ../
    # cd ..
    # ls -l
    total 12
    drwxr-xr-x 2 root root  190 Jun 19 23:34 bin
    drwxrwxrwx 2 root root    6 Mar  1  2016 catlet
    drwxrwxrwx 4 root root 4096 Jun 19 23:34 conf
    drwxr-xr-x 2 root root 4096 Jun 19 23:34 lib
    drwxrwxrwx 2 root root    6 Jan 22 22:01 logs
    drwxr-xr-x 2 root root    6 Jun 19 23:36 mycat
    -rwxrwxrwx 1 root root  219 Jan 22 22:00 version.txt
    # rm -rf ./mycat/
    
    

    此时,第一件事是备份 schema.xml、server.xml、rule.xml

    # cd conf
    # pwd
    /usr/mycat-1.6.5/conf
    # ls -l |egrep  'schema.xml|server.xml|rule.xml'
    -rwxrwxrwx 1 root root 4794 Jan 22 22:00 rule.xml
    -rwxrwxrwx 1 root root 4219 Jan 22 22:00 schema.xml
    -rwxrwxrwx 1 root root 4623 Jan 22 22:00 server.xml
    
    # cp schema.xml schema.xml.bak
    # cp server.xml server.xml.bak
    # cp rule.xml rule.xml.bak

    schema.xml

    <?xml version="1.0"?>
    <!DOCTYPE mycat:schema SYSTEM "schema.dtd">
    <mycat:schema xmlns:mycat="http://io.mycat/">
    
        <schema name="peiybdb" checkSQLschema="false" sqlMaxLimit="500">
            <table name="tmp_t0" dataNode="node2,node3" type="global" />
        </schema>
    
        <dataNode name="node2" dataHost="node2" database="peiybdb" />
        <dataNode name="node3" dataHost="node3" database="peiybdb" />
    
        <dataHost name="node2" maxCon="1000" minCon="10" balance="0" writeType="0" dbType="mysql" dbDriver="native" switchType="1"  slaveThreshold="100">
            <heartbeat>select user()</heartbeat>
            <!-- can have multi write hosts -->
            <writeHost host="node2" url="192.168.56.102:3306" user="peiyb" password="peiybpeiyb">
            </writeHost>
        </dataHost>
        <dataHost name="node3" maxCon="1000" minCon="10" balance="0" writeType="0" dbType="mysql" dbDriver="native" switchType="1"  slaveThreshold="100">
            <heartbeat>select user()</heartbeat>
            <!-- can have multi write hosts -->
            <writeHost host="node2" url="192.168.56.103:3306" user="peiyb" password="peiybpeiyb">
            </writeHost>
        </dataHost>
    </mycat:schema>

    server.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE mycat:server SYSTEM "server.dtd">
    <mycat:server xmlns:mycat="http://io.mycat/">
        <system>
            <property name="serverPort">3306</property>
            <property name="managerPort">3307</property>
        </system>
    
        <user name="root">
            <property name="password">rootroot</property>
            <property name="schemas">peiybdb</property>
        </user>
    </mycat:server>

    rule.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!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>
    
        <function name="func1" class="io.mycat.route.function.PartitionByLong">
            <property name="partitionCount">8</property>
            <property name="partitionLength">128</property>
        </function>
    </mycat:rule>

    启动mycat

    # cd /usr/mycat-1.6.5/bin
    # ./mycat start
    Starting Mycat-server...

    验证

    node2 节点上 show processlist
    可以看到 node1连接的线程

    mysql> show processlist;
    +----+-------+-------------+---------+---------+------+----------+------------------+
    | Id | User  | Host        | db      | Command | Time | State    | Info             |
    +----+-------+-------------+---------+---------+------+----------+------------------+
    |  5 | peiyb | node1:57482 | peiybdb | Sleep   |   18 |          | NULL             |
    |  6 | peiyb | node1:57496 | peiybdb | Sleep   |    0 |          | NULL             |
    |  7 | peiyb | node1:57488 | peiybdb | Sleep   |   18 |          | NULL             |
    |  8 | peiyb | node1:57490 | peiybdb | Sleep   |   18 |          | NULL             |
    |  9 | peiyb | node1:57492 | peiybdb | Sleep   |   18 |          | NULL             |
    | 10 | peiyb | node1:57484 | peiybdb | Sleep   |   19 |          | NULL             |
    | 11 | peiyb | node1:57494 | peiybdb | Sleep   |   19 |          | NULL             |
    | 12 | peiyb | node1:57486 | peiybdb | Sleep   |   18 |          | NULL             |
    | 13 | peiyb | node1:57498 | peiybdb | Sleep   |   18 |          | NULL             |
    | 14 | peiyb | node1:57500 | peiybdb | Sleep   |   10 |          | NULL             |
    | 15 | root  | localhost   | NULL    | Query   |    0 | starting | show processlist |
    +----+-------+-------------+---------+---------+------+----------+------------------+

    node3 节点上 show processlist
    也可以看到 node1连接的线程

    mysql> show processlist;
    +----+-------+-------------+---------+---------+------+----------+------------------+
    | Id | User  | Host        | db      | Command | Time | State    | Info             |
    +----+-------+-------------+---------+---------+------+----------+------------------+
    |  4 | peiyb | node1:32784 | peiybdb | Sleep   |   27 |          | NULL             |
    |  5 | peiyb | node1:32798 | peiybdb | Sleep   |   37 |          | NULL             |
    |  6 | peiyb | node1:32800 | peiybdb | Sleep   |   37 |          | NULL             |
    |  7 | peiyb | node1:32788 | peiybdb | Sleep   |   37 |          | NULL             |
    |  8 | peiyb | node1:32790 | peiybdb | Sleep   |   37 |          | NULL             |
    |  9 | peiyb | node1:32792 | peiybdb | Sleep   |    7 |          | NULL             |
    | 10 | peiyb | node1:32794 | peiybdb | Sleep   |   17 |          | NULL             |
    | 11 | peiyb | node1:32802 | peiybdb | Sleep   |   37 |          | NULL             |
    | 12 | peiyb | node1:32796 | peiybdb | Sleep   |   37 |          | NULL             |
    | 13 | peiyb | node1:32786 | peiybdb | Sleep   |   37 |          | NULL             |
    | 14 | root  | localhost   | NULL    | Query   |    0 | starting | show processlist |
    +----+-------+-------------+---------+---------+------+----------+------------------+
    11 rows in set (0.00 sec)

    登录 node1

    # mysql -h127.0.0.1 -P3306 -uroot -prootroot
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 1
    Server version: 5.6.29-mycat-1.6.5-release-20180122220033 MyCat Server (OpenCloundDB)
    
    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> 
    mysql> show databases;
    +----------+
    | DATABASE |
    +----------+
    | peiybdb  |
    +----------+
    1 row in set (0.01 sec)
    
    mysql> use peiybdb;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    mysql> 
    mysql> show tables;
    +-------------------+
    | Tables in peiybdb |
    +-------------------+
    | tmp_t0            |
    +-------------------+
    1 row in set (0.02 sec)
    
    mysql> select * from tmp_t0;
    ERROR 1146 (42S02): Table 'peiybdb.tmp_t0' doesn't exist

    在node1 上查询tmp_t0 时报错,是因为 node2、node3上并没有实体表 tmp_t0,可见在node1上看到的tmp_t0是在schema.xml里定义的,并不需要在node2、node3上真实存在。

    此时在node1上查看日志

    # pwd
    /usr/mycat-1.6.5/logs
    # ls -l
    total 40
    -rw-r--r-- 1 root root 30093 Jun 20 01:10 mycat.log
    -rw-r--r-- 1 root root     6 Jun 20 01:02 mycat.pid
    -rw-r--r-- 1 root root   971 Jun 20 01:02 wrapper.log
    # cat wrapper.log 
    STATUS | wrapper  | 2018/06/20 01:02:50 | --> Wrapper Started as Daemon
    STATUS | wrapper  | 2018/06/20 01:02:50 | Launching a JVM...
    INFO   | jvm 1    | 2018/06/20 01:02:50 | OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=64M; support was removed in 8.0
    INFO   | jvm 1    | 2018/06/20 01:02:52 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
    INFO   | jvm 1    | 2018/06/20 01:02:52 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
    INFO   | jvm 1    | 2018/06/20 01:02:52 | 
    INFO   | jvm 1    | 2018/06/20 01:02:54 | log4j:WARN No appenders could be found for logger (io.mycat.memory.MyCatMemory).
    INFO   | jvm 1    | 2018/06/20 01:02:54 | log4j:WARN Please initialize the log4j system properly.
    INFO   | jvm 1    | 2018/06/20 01:02:54 | log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    INFO   | jvm 1    | 2018/06/20 01:02:54 | MyCAT Server startup successfully. see logs in logs/mycat.log
    
    # cat mycat.pid
    18722
    
    # cat mycat.log 
    2018-06-20 01:02:54.051  INFO [WrapperSimpleAppMain] (io.mycat.backend.datasource.PhysicalDBPool.<init>(PhysicalDBPool.java:101)) - total resouces of dataHost node2 is :1
    2018-06-20 01:02:54.052  INFO [WrapperSimpleAppMain] (io.mycat.backend.datasource.PhysicalDBPool.<init>(PhysicalDBPool.java:101)) - total resouces of dataHost node3 is :1
    2018-06-20 01:02:54.056  INFO [WrapperSimpleAppMain] (io.mycat.cache.CacheService.createLayeredPool(CacheService.java:125)) - create layer cache pool TableID2Datanode3ache of type encache ,default cache size 10000 ,default expire seconds18000
    2018-06-20 01:02:54.057  INFO [WrapperSimpleAppMain] (io.mycat.cache.DefaultLayedCachePool.createChildCache(DefaultLayedCachePool.java:80)) - create child Cache: TESTDB_ORDERS for layered cache TableID2Datanode3ache, size 50000, expire seconds 18000
    2018-06-20 01:02:54.211  INFO [WrapperSimpleAppMain] (io.mycat.config.classloader.DynaClassLoader.<init>(DynaClassLoader.java:34)) - dyna class load from ./catlet,and auto check for class file modified every 60 seconds
    2018-06-20 01:02:54.228  INFO [WrapperSimpleAppMain] (io.mycat.MycatServer.startup(MycatServer.java:317)) - MyCat is ready to startup ...
    2018-06-20 01:02:54.228  INFO [WrapperSimpleAppMain] (io.mycat.MycatServer.startup(MycatServer.java:329)) - Startup processors ...,total processors:1,aio thread pool size:4    
     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:20
    2018-06-20 01:02:54.228  INFO [WrapperSimpleAppMain] (io.mycat.MycatServer.startup(MycatServer.java:330)) - 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=3306, managerPort=3307, charset=utf8, processors=1, processorExecutor=4, 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=20, maxResultSet=524288, bigResultSizeSqlCount=10, bufferUsagePercent=80, flowControlRejectStrategy=0, clearBigSqLResultSetMapMs=600000, defaultMaxLimit=100, sequnceHandlerType=0, sqlInterceptor=io.mycat.server.interceptor.impl.DefaultSqlInterceptor, sqlInterceptorType=select, sqlInterceptorFile=/usr/mycat-1.6.5/logs/sql.txt, mutiNodeLimitType=0, mutiNodePatchSize=100, defaultSqlParser=druidparser, usingAIO=0, packetHeaderSize=4, maxPacketSize=16777216, mycatNodeId=1]
    2018-06-20 01:02:54.275  INFO [WrapperSimpleAppMain] (io.mycat.MycatServer.startup(MycatServer.java:437)) - using nio network handler 
    2018-06-20 01:02:54.296  INFO [WrapperSimpleAppMain] (io.mycat.MycatServer.startup(MycatServer.java:453)) - $_MyCatManager is started and listening on 3307
    2018-06-20 01:02:54.296  INFO [WrapperSimpleAppMain] (io.mycat.MycatServer.startup(MycatServer.java:457)) - $_MyCatServer is started and listening on 3306
    2018-06-20 01:02:54.296  INFO [WrapperSimpleAppMain] (io.mycat.MycatServer.startup(MycatServer.java:459)) - ===============================================
    2018-06-20 01:02:54.296  INFO [WrapperSimpleAppMain] (io.mycat.MycatServer.startup(MycatServer.java:463)) - Initialize dataHost ...
    
    
    2018-06-20 01:02:55.554  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select count(*) as record_count from TMP_T0 at con:MySQLConnection [id=3, lastTime=1529427775529, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=9, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select count(*) as record_count from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@5e50e265], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:55.568  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select count(*) as record_count from TMP_T0 at con:MySQLConnection [id=9, lastTime=1529427775550, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=7, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select count(*) as record_count from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@5e50e265], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:55.571  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select count(*) as record_count from TMP_T0 at con:MySQLConnection [id=2, lastTime=1529427775569, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=14, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select count(*) as record_count from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@5e50e265], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:55.575  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select count(*) as record_count from TMP_T0 at con:MySQLConnection [id=10, lastTime=1529427775569, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=6, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select count(*) as record_count from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@5e50e265], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:55.579  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select count(*) as record_count from TMP_T0 at con:MySQLConnection [id=1, lastTime=1529427775569, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=11, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select count(*) as record_count from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@5e50e265], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:55.582  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select count(*) as record_count from TMP_T0 at con:MySQLConnection [id=6, lastTime=1529427775569, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=10, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select count(*) as record_count from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@5e50e265], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:55.583  WARN [$_NIOREACTOR-0-RW] (io.mycat.backend.heartbeat.MySQLConsistencyChecker.setResult(MySQLConsistencyChecker.java:165)) - null execute failed in db: peiybdb during global table consistency check task.
    2018-06-20 01:02:56.553  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select max(_mycat_op_time) as max_timestamp from TMP_T0 at con:MySQLConnection [id=7, lastTime=1529427776549, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=8, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select max(_mycat_op_time) as max_timestamp from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@dae5812], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:56.556  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select max(_mycat_op_time) as max_timestamp from TMP_T0 at con:MySQLConnection [id=4, lastTime=1529427776549, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=12, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select max(_mycat_op_time) as max_timestamp from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@dae5812], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:56.559  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select max(_mycat_op_time) as max_timestamp from TMP_T0 at con:MySQLConnection [id=5, lastTime=1529427776549, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=5, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select max(_mycat_op_time) as max_timestamp from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@dae5812], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:56.563  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select max(_mycat_op_time) as max_timestamp from TMP_T0 at con:MySQLConnection [id=8, lastTime=1529427776549, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=13, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select max(_mycat_op_time) as max_timestamp from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@dae5812], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:56.567  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select max(_mycat_op_time) as max_timestamp from TMP_T0 at con:MySQLConnection [id=3, lastTime=1529427776549, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=9, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select max(_mycat_op_time) as max_timestamp from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@dae5812], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:56.572  INFO [$_NIOREACTOR-0-RW] (io.mycat.sqlengine.SQLJob.errorResponse(SQLJob.java:135)) - error response errno:1146, Table 'peiybdb.TMP_T0' doesn't exist from of sql : select max(_mycat_op_time) as max_timestamp from TMP_T0 at con:MySQLConnection [id=9, lastTime=1529427776549, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=7, charset=latin1, txIsolation=3, autocommit=true, attachment=null, respHandler=SQLJob [ id=0,dataNodeOrDatabase=peiybdb,sql= select max(_mycat_op_time) as max_timestamp from TMP_T0,  jobHandler=io.mycat.sqlengine.OneRawSQLQueryResultHandler@dae5812], host=192.168.56.102, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
    2018-06-20 01:02:56.572  WARN [$_NIOREACTOR-0-RW] (io.mycat.backend.heartbeat.MySQLConsistencyChecker.setResult(MySQLConsistencyChecker.java:165)) - null execute failed in db: peiybdb during global table consistency check task.
    2018-06-20 01:08:45.971  INFO [$_NIOREACTOR-0-RW] (io.mycat.net.handler.FrontendAuthenticator.success(FrontendAuthenticator.java:226)) - ServerConnection [id=1, schema=null, host=127.0.0.1, user=root,txIsolation=3, autocommit=true, schema=null]'root' login success
    2018-06-20 01:10:20.001  WARN [$_NIOREACTOR-0-RW] (io.mycat.backend.mysql.nio.handler.SingleNodeHandler.backConnectionErr(SingleNodeHandler.java:250)) - execute  sql err : errno:1146 Table 'peiybdb.tmp_t0' doesn't exist con:MySQLConnection [id=7, lastTime=1529428219995, user=peiyb, schema=peiybdb, old shema=peiybdb, borrowed=true, fromSlaveDB=false, threadId=8, charset=utf8, txIsolation=3, autocommit=true, attachment=node2{SELECT *
    FROM tmp_t0
    LIMIT 500}, respHandler=SingleNodeHandler [node=node2{SELECT *
    FROM tmp_t0
    LIMIT 500}, packetId=1], host=192.168.56.102, port=3306, statusSync=io.mycat.backend.mysql.nio.MySQLConnection$StatusSync@320f460, writeQueue=0, modifiedSQLExecuted=false] frontend host:127.0.0.1/58438/root
    

    通过node1节点的mycat创建表,及查询。

    mysql> create table tmp_t0(c1 varchar(100),c2 varchar(100),c3 varchar(100));
    mysql> select * from tmp_t0;
    Empty set (0.00 sec)

    参考:
    https://dev.mysql.com/downloads/mysql/5.7.html#downloads
    https://github.com/MyCATApache/Mycat-download-new
    http://www.mycat.io/
    http://www.mycat.org.cn

  • 相关阅读:
    汪博士解读PMP考试
    ASP.NET编程实战宝典(光盘内容另行下载,地址见书封底)
    [模板]tarjan算法求SCC
    [POJ 3071]Football[概率DP]
    [数学]根式有理化[高中数学技巧]
    [平面几何]角格点问题
    [数学]对数均值不等式
    [模板][快速排序&归并排序]
    [POJ]P3126 Prime Path[BFS]
    每日一题_191219
  • 原文地址:https://www.cnblogs.com/ctypyb2002/p/9792963.html
Copyright © 2020-2023  润新知