慢查询和innobackup备份导致数据库挂起
来源:互联网 发布:怎样查看linux登录锁定 编辑:程序博客网 时间:2024/06/18 11:38
现象
- 短信报警凌晨的备份任务失败;
- 研发说应用挂了,应用都重启过了,貌似还没解决;
- 其他cpu、磁盘空间、日志等指标都正常,没收到报警,疑惑;
排查
- 凌晨1点开始的备份不成功:
>> log scanned up to (348743804470)xtrabackup: Creating suspend file '/data1/backup/2017-11-14_01-00-06/xtrabackup_suspended_2' with pid '3048'171114 01:06:15 innobackupex: Continuing after ibbackup has suspended171114 01:06:15 innobackupex: Executing FLUSH NO_WRITE_TO_BINLOG TABLES...>> log scanned up to (348743819365)>> log scanned up to (348743830358)>> log scanned up to (348743838117)>> log scanned up to (348743848569)……
- 同时,某个慢查询已经执行了1个多小时还没完成,一直Sending data状态;
- 大量SQL开始等待,状态:Waiting for table flush
分析
关于Waiting for table flush,官方说明:
The thread is executing FLUSH TABLES and is waiting for all threads to close their tables, or the thread got a notification that the underlying structure for a table has changed and it needs to reopen the table to get the new structure. However, to reopen the table, it must wait until all other threads have closed the table in question.
This notification takes place if another thread has used FLUSH TABLES or one of the following statements on the table in question: FLUSH TABLES tbl_name,
This notification takes place if another thread has used FLUSH TABLES or one of the following statements on the table in question: FLUSH TABLES tbl_name,
本案中大量进程Waiting for table flush,就是等待innobackup flush table后,close这些表。但innobackup被慢查询卡住了。
解决
innobackup有几个参数可以应对这种情况:
--kill-long-queries-timeout=N (seconds)
how many time we give for queries to complete after FLUSH TABLES WITH READ LOCK is issued before start to kill. Default if 0, not to kill.
--kill-long-query-type={all|select}
--kill-long-query-type={all|select}
which queries should be killed once kill-long-queries-timeout has expired.
举例:
innobackupex --user=root --password=password --kill-long-queries-timeout=30 --kill-long-query-type=all /backup/
innobackup等待30秒后,杀死堵塞的进程,可以顺利完成备份,不会对其他DML操作产生影响。
阅读全文
0 0
- 慢查询和innobackup备份导致数据库挂起
- percona之innobackup备份数据库
- innobackup 备份还原原理和操作
- oracle数据库中,字段类型不一致,导致查询慢
- 由于archive挂起导致数据库挂死
- innobackup备份数据主从同步点确定
- MySQL数据库慢查询日志开启和查询工具
- mysql备份利器 Innobackup 大数据备份还原
- MySQL前缀索引导致的慢查询
- SQL Server数据库查询速度慢的原因和解决方法
- SQL Server数据库查询速度慢的原因和解决方法
- SQL Server数据库查询速度慢的原因和解决方法
- SQL Server数据库查询速度慢的原因和解决方法
- 数据库查询慢的原因
- 数据库查询慢的原因
- 数据库查询慢的分析
- 数据库查询慢的分析
- mysql数据库开启慢查询
- 关于opencv3.3.0+vs2015 +x86debug版本配置方法
- mysql
- 创投日报:11月14日收录投融资项目13起
- table及div中img下方留白&div宽度随内容而变
- 携程就“亲子园事件”发表通报;.一点资讯获1.12亿美元融资;亚马逊AWS否认出售中国区云计算业务丨价值早报
- 慢查询和innobackup备份导致数据库挂起
- 【云星数据---Apache Flink实战系列(精品版)】:Apache Flink实战基础0018--IDEA搭建非maven管理的集成开发环境003
- Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:错误
- centos6安装,配置,启动apache
- windows 安装python 2.7 安装pip 步骤
- linux 加解压命令记录
- C++中的static关键字的总结
- mysql集群的优缺点
- yii2 下使用memcached(非memcache)