请教小弟我的linux mysql 状态状态健康吗

请教小弟我的mysql状态健康吗_百度知道> 请教小弟我的mysql状态健康吗?请专家帮小弟我看看,多谢
请教小弟我的mysql状态健康吗?请专家帮小弟我看看,多谢
xiehaoyu & &
发布时间: & &
浏览:2 & &
回复:0 & &
悬赏:0.0希赛币
请问我的mysql状态健康吗?请专家帮我看看,谢谢。程序语言是java,使用了数据库连接池,一共有三台服务器对该数据库服务器进行连接,运行2天左右就会出现错误,错误内容为:com.mysql.jdbc.exceptions.MySQLTimeoutException: Statement cancelled due to timeout or client request数据库的状态情况如下(连接IP进行了处理):*************************** 1. row *************************** & Type: InnoDB & Name:& Status:& =====================================:10:26 INNODB MONITOR OUTPUT=====================================Per second averages calculated from the last 26 seconds-----------------BACKGROUND THREAD-----------------srv_master_thread loops: _second, 114372 sleeps, 10378 10_second, 10693 background, 10693 flushsrv_master_thread log flush and writes: 115265----------SEMAPHORES----------OS WAIT ARRAY INFO: reservation count 8733, signal count 8790Mutex spin waits 3197, rounds 5875, OS waits 132RW-shared spins 8430, rounds 251786, OS waits 8389RW-excl spins 4, rounds 6444, OS waits 211Spin rounds per wait: 1.84 mutex, 29.87 RW-shared, 1611.00 RW-excl------------TRANSACTIONS------------Trx id counter A5088Purge done for trx's n:o & A506E undo n:o & 0History list length 2904LIST OF TRANSACTIONS FOR EACH SESSION:---TRANSACTION 0, not startedMySQL thread id 648, OS thread handle 0x7fbebda63700, query id .0.0.1 rootshow engine innodb status---TRANSACTION A5059, not startedMySQL thread id 647, OS thread handle 0x7fbebd54f700, query id 375680 *.73.*.* asdktj34_sdfjssg---TRANSACTION A5076, not startedMySQL thread id 646, OS thread handle 0x7fbebd89c700, query id 375679 *.73.*.* asdktj34_sdfjssg---TRANSACTION A5081, not startedMySQL thread id 645, OS thread handle 0x7fbebd07c700, query id 375718 *.*.*.141 asdktj34_sdfjssg---TRANSACTION A507E, not startedMySQL thread id 644, OS thread handle 0x7fbebd13f700, query id 375713 *.*.*.141 asdktj34_sdfjssg---TRANSACTION A5079, not startedMySQL thread id 643, OS thread handle 0x7fbebd612700, query id 375717 *.*.*.141 asdktj34_sdfjssg---TRANSACTION A5001, not startedMySQL thread id 642, OS thread handle 0x7fbebd306700, query id 375716 *.*.*.141 asdktj34_sdfjssg---TRANSACTION A5024, not startedMySQL thread id 641, OS thread handle 0x7fbebcf37700, query id 375734 *.*.*.141 asdktj34_sdfjssg---TRANSACTION A4E83, not startedMySQL thread id 640, OS thread handle 0x7fbebd284700, query id 374450 *.*.*.143 asdktj34_sdfjssg---TRANSACTION A4FBA, not startedMySQL thread id 639, OS thread handle 0x7fbebd180700, query id 375248 *.*.*.143 asdktj34_sdfjssg---TRANSACTION A5073, not startedMySQL thread id 638, OS thread handle 0x7fbebd95f700, query id 375701 *.73.*.* asdktj34_sdfjssg---TRANSACTION A506A, not startedMySQL thread id 637, OS thread handle 0x7fbebcffa700, query id 375690 *.73.*.* asdktj34_sdfjssg---TRANSACTION A506F, not startedMySQL thread id 635, OS thread handle 0x7fbebd6d5700, query id 375691 *.73.*.* asdktj34_sdfjssg---TRANSACTION A5069, not startedMySQL thread id 636, OS thread handle 0x7fbebda22700, query id 375681 *.73.*.* asdktj34_sdfjssg---TRANSACTION A5074, not startedMySQL thread id 634, OS thread handle 0x7fbebccad700, query id 375669 *.*.*.143 asdktj34_sdfjssg---TRANSACTION A507B, not startedMySQL thread id 633, OS thread handle 0x7fbebd243700, query id 375733 *.*.*.141 asdktj34_sdfjssg---TRANSACTION A5087, not startedMySQL thread id 632, OS thread handle 0x7fbebd694700, query id 375735 *.*.*.141 asdktj34_sdfjssg---TRANSACTION A507A, not startedMySQL thread id 630, OS thread handle 0x7fbebd5d1700, query id 375699 *.73.*.* asdktj34_sdfjssg---TRANSACTION A5065, not startedMySQL thread id 631, OS thread handle 0x7fbebce33700, query id 375700 *.73.*.* asdktj34_sdfjssg---TRANSACTION A4FAF, not startedMySQL thread id 629, OS thread handle 0x7fbebcd70700, query id 375230 *.*.*.143 asdktj34_sdfjssg
本问题标题:
本问题地址:
温馨提示:本问答中心的任何言论仅代表发言者个人的观点,与希赛网立场无关。请对您的言论负责,遵守中华人民共和国有关法律、法规。如果您的言论违反希赛网问答中心的规则,将会被删除。
暂无合适的专家
&&&&&&&&&&&&&&&
希赛网 版权所有 & &&请教:看我的MySql和PHP是否安装正常,系统测试安装信息如下:_百度知道博客访问: 2079614
博文数量: 222
注册时间:
10年接触数据库,恰逢公司上ERP系统;期间从管理公司的erp数据库到管理公司所有的数据库过程,学习到的不仅仅是做技术,更多的是技术的管理;
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: MySQL
日常工作中,对于MYSQL主从复制的检查有两方面
保证复制的整体结构是否完整;
需要检查数据是否一致;
对于前者我们可以通过监控复制线程是否工作正常以及主从延时是否在容忍范围内,对于后者则可以通过分别校验主从表中数据的md5码是否一致,来保证数据一致,可以使用Maatkit工具包中的mk-table-checksum工具去检查。
本文档介绍下关于如何检查主从延迟的问题。
主从延迟判断的方法,通常有两种方法:Seconds_Behind_Master和mk-heartbeat
方法1. 通过监控show slave status\G命令输出的Seconds_Behind_Master参数的值来判断,是否有发生主从延时。
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host:
Master_User:
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000022
Read_Master_Log_Pos:
Relay_Log_File: ***-relay-bin.000011
Relay_Log_Pos:
Relay_Master_Log_File: mysql-bin.000022
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: retail
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos:
Relay_Log_Space:
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 2
1 row in set (0.00 sec)
以上是show slave status\G的输出结果,这些结构给我们的监控提供了很多有意义的参数。
Slave_IO_Running:该参数可作为io_thread的监控项,Yes表示io_thread的和主库连接正常并能实施复制工作,No则说明与主库通讯异常,多数情况是由主从间网络引起的问题;
Slave_SQL_Running:该参数代表sql_thread是否正常,具体就是语句是否执行通过,常会遇到主键重复或是某个表不存在。
Seconds_Behind_Master:是通过比较sql_thread执行的event的timestamp和io_thread复制好的event的timestamp(简写为ts)进行比较,而得到的这么一个差值;
NULL—表示io_thread或是sql_thread有任何一个发生故障,也就是该线程的Running状态是No,而非Yes。
0 — 该值为零,是我们极为渴望看到的情况,表示主从复制良好,可以认为lag不存在。
正值 — 表示主从已经出现延时,数字越大表示从库落后主库越多。
负值 — 几乎很少见,我只是听一些资深的DBA说见过,其实,这是一个BUG值,该参数是不支持负值的,也就是不应该出现。
备注Seconds_Behind_Master的计算方式可能带来的问题:我们都知道的relay-log和主库的bin-log里面的内容完全一样,在记录sql语句的同时会被记录上当时的ts,所以比较参考的值来自于binlog,其实主从没有必要与NTP进行同步,也就是说无需保证主从时钟的一致。你也会发现,其实比较真正是发生在io_thread与sql_thread之间,而io_thread才真正与主库有关联,于是,问题就出来了,当主库I/O负载很大或是网络阻塞,io_thread不能及时复制binlog(没有中断,也在复制),而sql_thread一直都能跟上io_thread的脚本,这时Seconds_Behind_Master的值是0,也就是我们认为的无延时,但是,实际上不是,你懂得。这也就是为什么大家要批判用这个参数来监控数据库是否发生延时不准的原因,但是这个值并不是总是不准,如果当io_thread与master网络很好的情况下,那么该值也是很有价值的。之前,提到Seconds_Behind_Master这个参数会有负值出现,我们已经知道该值是io_thread的最近跟新的ts与sql_thread执行到的ts差值,前者始终是大于后者的,唯一的肯能就是某个event的ts发生了错误,比之前的小了,那么当这种情况发生时,负值出现就成为可能。
方法2. mk-heartbeat:Maatkit万能工具包中的一个工具,被认为可以准确判断复制延时的方法。
mk-heartbeat的实现也是借助timestmp的比较实现的,它首先需要保证主从服务器必须要保持一致,通过与相同的一个NTP server同步时钟。它需要在主库上创建一个heartbeat的表,里面至少有id与ts两个字段,id为server_id,ts就是当前的时间戳now(),该结构也会被复制到从库上,表建好以后,会在主库上以后台进程的模式去执行一行更新操作的命令,定期去向表中的插入数据,这个周期默认为1秒,同时从库也会在后台执行一个监控命令,与主库保持一致的周期去比较,复制过来记录的ts值与主库上的同一条ts值,差值为0表示无延时,差值越大表示延时的秒数越多。我们都知道复制是异步的ts不肯完全一致,所以该工具允许半秒的差距,在这之内的差异都可忽略认为无延时。这个工具就是通过实打实的复制,巧妙的借用timestamp来检查延时;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
本文作者:JOHN QQ: (请备注数据库)
ORACLE 猎人笔记
请扫描加微信号!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
阅读(9211) | 评论(0) | 转发(2) |
相关热门文章
给主人留下些什么吧!~~
请登录后评论。

我要回帖

更多关于 centos 查看mysql状态 的文章

 

随机推荐