《Mycat学习笔记》 第四篇. MyCat 日志简单分析

环境说明

Windows 7  Mycat 1.5 Mysql 5.5 一个实例两个库 traveldata_db_1 和 traveldata_db_2

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mycat_sync_test |
| mysql |
| performance_schema |
| traveldata_db_1 |
| traveldata_db_2 |
+--------------------+
6 rows in set (0.00 sec)

Mycat 服务启动,初始化各项数据参数

01/22 15:54:33.041 INFO [WrapperSimpleAppMain] (MycatServer.java:197) -===============================================
01/22 15:54:33.041 INFO [WrapperSimpleAppMain] (MycatServer.java:198) -MyCat is ready to startup ...
01/22 15:54:33.041 INFO [WrapperSimpleAppMain] (MycatServer.java:208) -Startup processors ...,total processors:2,aio thread pool size:4
each process allocated socket buffer pool bytes ,buffer chunk size:4096 buffer pool‘s capacity(buferPool/bufferChunk) is:2000
01/22 15:54:33.041 INFO [WrapperSimpleAppMain] (MycatServer.java:209) -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=2, 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, processorBufferPool=8192000, processorBufferChunk=4096, defaultMaxLimit=100, sequnceHandlerType=0, sqlInterceptor=org.opencloudb.interceptor.impl.DefaultSqlInterceptor, sqlInterceptorType=select, sqlInterceptorFile=D:\bin\mycat\mycat1.5/logs/sql.txt, mutiNodeLimitType=0, mutiNodePatchSize=100, defaultSqlParser=druidparser, usingAIO=0, packetHeaderSize=4, maxPacketSize=16777216, mycatNodeId=1]
01/22 15:54:33.062 INFO [WrapperSimpleAppMain] (MycatServer.java:268) -using nio network handler
01/22 15:54:33.089 INFO [WrapperSimpleAppMain] (MycatServer.java:286) -$_MyCatManager is started and listening on 9066
01/22 15:54:33.090 INFO [WrapperSimpleAppMain] (MycatServer.java:290) -$_MyCatServer is started and listening on 8066
01/22 15:54:33.090 INFO [WrapperSimpleAppMain] (MycatServer.java:292) -===============================================

01/22 15:54:33.090 INFO [WrapperSimpleAppMain] (MycatServer.java:295) -Initialize dataHost ...

分别在物理库上建立数据库连接
01/22 15:54:33.090 INFO [WrapperSimpleAppMain] (PhysicalDBPool.java:294) -init backend myqsl source ,create connections total 10 for hostM1 index :0
01/22 15:54:33.091 INFO [WrapperSimpleAppMain] (PhysicalDatasource.java:373) -not ilde connection in pool,create new connection for hostM1 of schema traveldata_db_1
01/22 15:54:33.092 INFO [WrapperSimpleAppMain] (PhysicalDatasource.java:373) -not ilde connection in pool,create new connection for hostM1 of schema traveldata_db_2
01/22 15:54:33.093 INFO [WrapperSimpleAppMain] (PhysicalDatasource.java:373) -not ilde connection in pool,create new connection for hostM1 of schema traveldata_db_1
01/22 15:54:33.093 INFO [WrapperSimpleAppMain] (PhysicalDatasource.java:373) -not ilde connection in pool,create new connection for hostM1 of schema traveldata_db_2
01/22 15:54:33.093 INFO [WrapperSimpleAppMain] (PhysicalDatasource.java:373) -not ilde connection in pool,create new connection for hostM1 of schema traveldata_db_1
01/22 15:54:33.093 INFO [WrapperSimpleAppMain] (PhysicalDatasource.java:373) -not ilde connection in pool,create new connection for hostM1 of schema traveldata_db_2
01/22 15:54:33.096 INFO [WrapperSimpleAppMain] (PhysicalDatasource.java:373) -not ilde connection in pool,create new connection for hostM1 of schema traveldata_db_1
01/22 15:54:33.096 INFO [WrapperSimpleAppMain] (PhysicalDatasource.java:373) -not ilde connection in pool,create new connection for hostM1 of schema traveldata_db_2
01/22 15:54:33.096 INFO [WrapperSimpleAppMain] (PhysicalDatasource.java:373) -not ilde connection in pool,create new connection for hostM1 of schema traveldata_db_1
01/22 15:54:33.096 INFO [WrapperSimpleAppMain] (PhysicalDatasource.java:373) -not ilde connection in pool,create new connection for hostM1 of schema traveldata_db_2

看上去像是连接成功

01/22 15:54:33.127 INFO [$_NIOREACTOR-0-RW] (GetConnectionHandler.java:66) -connected successfuly MySQLConnection [id=8, lastTime=1453449273127, user=root, schema=traveldata_db_2, old shema=traveldata_db_2, borrowed=true, fromSlaveDB=false, threadId=291, charset=utf8, txIsolation=0, autocommit=true, attachment=null, respHandler=null, host=localhost, port=3308, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]

01/22 15:54:33.127 INFO [$_NIOREACTOR-1-RW] (GetConnectionHandler.java:66) -connected successfuly MySQLConnection [id=7, lastTime=1453449273127, user=root, schema=traveldata_db_2, old shema=traveldata_db_2, borrowed=true, fromSlaveDB=false, threadId=294, charset=utf8, txIsolation=0, autocommit=true, attachment=null, respHandler=null, host=localhost, port=3308, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]

主动断开数据库连接
01/22 15:54:33.127 DEBUG [$_NIOREACTOR-0-RW] (PhysicalDatasource.java:403) -release channel MySQLConnection [id=8, lastTime=1453449273127, user=root, schema=traveldata_db_2, old shema=traveldata_db_2, borrowed=true, fromSlaveDB=false, threadId=291, charset=utf8, txIsolation=0, autocommit=true, attachment=null, respHandler=null, host=localhost, port=3308, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
01/22 15:54:33.127 DEBUG [$_NIOREACTOR-1-RW] (PhysicalDatasource.java:403) -release channel MySQLConnection [id=7, lastTime=1453449273127, user=root, schema=traveldata_db_2, old shema=traveldata_db_2, borrowed=true, fromSlaveDB=false, threadId=294, charset=utf8, txIsolation=0, autocommit=true, attachment=null, respHandler=null, host=localhost, port=3308, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]

DML语句执行分析

01/22 16:26:14.058 DEBUG [$_NIOREACTOR-1-RW] (ServerQueryHandler.java:56) -ServerConnection [id=1, schema=TRDB, host=0:0:0:0:0:0:0:1, user=test,txIsolation=3, autocommit=true, schema=TRDB]select * from t_vote

没有加入查询条件,即不命中Cache,分析出来需要执行2次查询并进行数据拼装
01/22 16:26:14.059 DEBUG [$_NIOREACTOR-1-RW] (EnchachePool.java:70) -SQLRouteCache hit cache ,key:TRDBselect * from t_vote
01/22 16:26:14.059 DEBUG [$_NIOREACTOR-1-RW] (NonBlockingSession.java:113) -ServerConnection [id=1, schema=TRDB, host=0:0:0:0:0:0:0:1, user=test,txIsolation=3, autocommit=true, schema=TRDB]select * from t_vote, route={
1 -> dn1{SELECT *
FROM t_vote
LIMIT 100}
2 -> dn3{SELECT *
FROM t_vote
LIMIT 100}
} rrs
01/22 16:26:14.059 DEBUG [$_NIOREACTOR-1-RW] (MultiNodeQueryHandler.java:82) -execute mutinode query select * from t_vote
01/22 16:26:14.060 DEBUG [$_NIOREACTOR-1-RW] (MultiNodeQueryHandler.java:97) -has data merge logic
01/22 16:26:14.060 DEBUG [$_NIOREACTOR-1-RW] (PhysicalDBPool.java:452) -select read source hostM1 for dataHost:localhost1
01/22 16:26:14.060 DEBUG [$_NIOREACTOR-1-RW] (MySQLConnection.java:445) -con need syn ,total syn cmd 1 commands SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;schema change:false con:MySQLConnection [id=28, lastTime=1453451174060, user=root, schema=traveldata_db_1, old shema=traveldata_db_1, borrowed=true, fromSlaveDB=false, threadId=313, charset=utf8, txIsolation=0, autocommit=true, attachment=dn1{SELECT *
FROM t_vote
LIMIT 100}, res[email protected]33c40638, host=localhost, port=3308, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]

发起Mysql查询请求
01/22 16:26:14.061 DEBUG [$_NIOREACTOR-1-RW] (PhysicalDBPool.java:452) -select read source hostM1 for dataHost:localhost1
01/22 16:26:14.061 DEBUG [$_NIOREACTOR-1-RW] (MySQLConnection.java:445) -con need syn ,total syn cmd 1 commands SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;schema change:false con:MySQLConnection [id=33, lastTime=1453451174061, user=root, schema=traveldata_db_2, old shema=traveldata_db_2, borrowed=true, fromSlaveDB=false, threadId=318, charset=utf8, txIsolation=0, autocommit=true, attachment=dn3{SELECT *
FROM t_vote
LIMIT 100}, res[email protected]33c40638, host=localhost, port=3308, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]

得到响应结果
01/22 16:26:14.061 DEBUG [$_NIOREACTOR-0-RW] (MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:false from MySQLConnection [id=28, lastTime=1453451174048, user=root, schema=traveldata_db_1, old shema=traveldata_db_1, borrowed=true, fromSlaveDB=false, threadId=313, charset=utf8, txIsolation=3, autocommit=true, attachment=dn1{SELECT *
FROM t_vote
LIMIT 100}, res[email protected]33c40638, host=localhost, port=3308, [email protected]746115, writeQueue=0, modifiedSQLExecuted=false]
01/22 16:26:14.062 DEBUG [$_NIOREACTOR-0-RW] (DataMergeService.java:94) -field metadata inf:[DATA=ColMeta [colIndex=2, colType=253], VID=ColMeta [colIndex=0, colType=3], PROVINCE=ColMeta [colIndex=1, colType=3]]
01/22 16:26:14.062 DEBUG [$_NIOREACTOR-1-RW] (MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:false from MySQLConnection [id=33, lastTime=1453451174048, user=root, schema=traveldata_db_2, old shema=traveldata_db_2, borrowed=true, fromSlaveDB=false, threadId=318, charset=utf8, txIsolation=3, autocommit=true, attachment=dn3{SELECT *
FROM t_vote
LIMIT 100}, res[email protected]33c40638, host=localhost, port=3308, [email protected]e7c324a, writeQueue=0, modifiedSQLExecuted=false]

这步开始应该开始做数据整合
01/22 16:26:14.062 DEBUG [$_NIOREACTOR-0-RW] (MultiNodeQueryHandler.java:241) -on row end reseponse MySQLConnection [id=28, lastTime=1453451174048, user=root, schema=traveldata_db_1, old shema=traveldata_db_1, borrowed=true, fromSlaveDB=false, threadId=313, charset=utf8, txIsolation=3, autocommit=true, attachment=dn1{SELECT *
FROM t_vote
LIMIT 100}, res[email protected]33c40638, host=localhost, port=3308, [email protected]746115, writeQueue=0, modifiedSQLExecuted=false]
01/22 16:26:14.062 DEBUG [$_NIOREACTOR-1-RW] (MultiNodeQueryHandler.java:241) -on row end reseponse MySQLConnection [id=33, lastTime=1453451174048, user=root, schema=traveldata_db_2, old shema=traveldata_db_2, borrowed=true, fromSlaveDB=false, threadId=318, charset=utf8, txIsolation=3, autocommit=true, attachment=dn3{SELECT *
FROM t_vote
LIMIT 100}, res[email protected]33c40638, host=localhost, port=3308, [email protected]e7c324a, writeQueue=0, modifiedSQLExecuted=false]

释放数据库连接
01/22 16:26:14.063 DEBUG [$_NIOREACTOR-0-RW] (NonBlockingSession.java:229) -release connection MySQLConnection [id=28, lastTime=1453451174048, user=root, schema=traveldata_db_1, old shema=traveldata_db_1, borrowed=true, fromSlaveDB=false, threadId=313, charset=utf8, txIsolation=3, autocommit=true, attachment=dn1{SELECT *
FROM t_vote
LIMIT 100}, res[email protected]33c40638, host=localhost, port=3308, [email protected]746115, writeQueue=0, modifiedSQLExecuted=false]

OK,整个查询的日志基本如此。

时间: 2024-11-03 22:11:21

《Mycat学习笔记》 第四篇. MyCat 日志简单分析的相关文章

《Mycat学习笔记》 第二篇. MySql 读写分离与日志分析——主从多结点

1    环境说明 接上篇环境   <Mycat学习笔记> 第一篇. MySql 读写分离与日志分析——主从单结点 http://www.cnblogs.com/kaye0110/p/5134588.html 增加一套 mysql 实例,端口为3308 ,通过Binlog方式同步主机情况 localhost : 3306 主机,    在mycat 中配置为 writehost 1 localhost : 3307 从机 a ,在mycat 中配置为 readhost localhost :

MyCat 学习笔记 第十篇.数据分片 之 ER分片

1 应用场景 这篇来说下mycat中自带的er关系分片,所谓er关系分片即可以理解为有关联关系表之间数据分片.类似于订单主表与订单详情表间的分片存储规则. 本文所说的er分片分为两种: a. 依据主键进行数据分片,验证发现主表数据保存在第1个datanode中,子表数据根据分片规则存储. b. 依据分片关键字段进行分片,验证发现主表与子表根据分片规则存储,且保存在相同的分片内. 接下来,可以下实际配置与数据验证 2 环境说明 参考  <MyCat 学习笔记>第六篇.数据分片 之 按月数据分片 

Dynamic CRM 2013学习笔记(四十六)简单审批流的实现

前面介绍过自定义审批流: Dynamic CRM 2013学习笔记(十九)自定义审批流1 - 效果演示 Dynamic CRM 2013学习笔记(二十一)自定义审批流2 - 配置按钮 Dynamic CRM 2013学习笔记(三十二)自定义审批流3 - 节点及实体配置 Dynamic CRM 2013学习笔记(三十三)自定义审批流4 - 规则节点 -有分支的流程处理 Dynamic CRM 2013学习笔记(三十四)自定义审批流5 - 自动邮件通知 Dynamic CRM 2013学习笔记(三十

MyCat 学习笔记 第十一篇.数据分片 之 分片事务处理

1 环境说明 VM 模拟3台MYSQL 5.6 服务器 VM1 192.168.31.187:3307 VM2 192.168.31.212:3307 VM3 192.168.31.150:  3307 MYCAT 1.5 服务部署在宿主机上 MYCAT 192.168.31.207 :8806[SQL执行端口] / 9066[管理端口] 2 应用场景 2.0 MYCAT配置 schema.xml <schema name="TESTDB" checkSQLschema=&quo

MyCat 学习笔记 第十一篇.数据分片 之 分片数据查询 ( select * from table_name limit 100000,100 )

1 环境说明 VM 模拟3台MYSQL 5.6 服务器 VM1 192.168.31.187:3307 VM2 192.168.31.212:3307 VM3 192.168.31.150:  3307 MYCAT 1.5 服务部署在宿主机上 MYCAT 192.168.31.207 :8806[SQL执行端口] / 9066[管理端口] 2 应用场景 2.0 MYCAT配置 schema.xml <schema name="TESTDB" checkSQLschema=&quo

MyCat 学习笔记 第十三篇.数据分片 之 通过HINT执行存储过程

1 环境说明 VM 模拟3台MYSQL 5.6 服务器 VM1 192.168.31.187:3307 VM2 192.168.31.212:3307 VM3 192.168.31.150:  3307 MYCAT 1.5 服务部署在宿主机上 MYCAT 192.168.31.207 :8806[SQL执行端口] / 9066[管理端口] 2 应用场景 2.0 MYCAT配置 schema.xml <schema name="TESTDB" checkSQLschema=&quo

linux学习笔记 第四篇

软件安装 软件名称的识别 rpm结尾的是用于 redhat操作系统 abrt-addon-ccpp-   软件的名字 2.1.11-19          软件版本号 e17                软件适用系统 x68_64             系统架构 关于linux软件的安装,举个例子,现在我们要在虚拟机里面安装"火狐"浏览器,怎么办呢? 首先,我们要在真机里面找到这个安装包 通过ssh服务将这个安装包发送给虚拟机 在虚拟机里的/mnt目录下就能找到这个安装包啦 然后点

Spring学习笔记(四)-- Spring事务全面分析

通过本系列的文章对Spring的介绍,我们对Spring的使用和两个核心功能IOC.AOP已经有了初步的了解,结合我个人工作的情况,由于项目是金融系 统,那对事务的控制是必不可少的,并且是非常严格的控制.根据我对项目的研究,它在管理模块用的是JTA的事务,而在交易模块用的是JDBC的事 务,但是,所有的这些事务的使用,都是用Spring封装后的编程式事务.我在看完<Spring In Action>后,在网上看了下大家对Spring事务的理解,貌 似都没有真正的文章是去全面剖析Spring对这

Directx11学习笔记【四】 封装一个简单的Dx11DemoBase

根据前面两个笔记的内容,我们来封装一个简单的基类,方便以后的使用. 代码和前面类似,没有什么新的内容,直接看代码吧(由于代码上次都注释了,这次代码就没怎么写注释o(╯□╰)o) Dx11DemoBase.h Dx11DemoBase.h #pragma once #include <d3d11.h> #include <D3DX11.h> #include <DxErr.h> class Dx11DemoBase { public: Dx11DemoBase(); vi

stata学习笔记(四):主成份分析与因子分析

1.判断是否适合做主成份分析,变量标准化 Kaiser-Meyer-Olkin抽样充分性测度也是用于测量变量之间相关关系的强弱的重要指标,是通过比较两个变量的相关系数与偏相关系数得到的. KMO介于0于1之间.KMO越高,表明变量的共性越强.如果偏相关系数相对于相关系数比较高,则KMO比较低,主成分分析不能起到很好的数据约化效果. 根据Kaiser(1974),一般的判断标准如下: 0.00-0.49,不能接受(unacceptable); 0.50-0.59,非常差(miserable): 0