Diagnosing MySQL Server Freezes and Stalls, Sometimes Called Crashes

本文主要是介绍Diagnosing MySQL Server Freezes and Stalls, Sometimes Called Crashes,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!


Diagnosing MySQL Server Freezes and Stalls, Sometimes Called Crashes 

转到底部

https://support.oracle.com/epmos/adf/images/t.gif


https://support.oracle.com/epmos/adf/images/t.gif

In this Document

 

Purpose

 

 

Troubleshooting Steps

 

 

1. Check query cache free blocks count.

 

 

2. If using InnoDB, check SHOW ENGINE INNODB STATUS.

 

 

3. Check SHOW PROCESSLIST and search the knowledge base for the text of the values in the State column.

 

 

4. Open a service request.

 

 

References


APPLIES TO:

MySQL Server - Version 4.0 and later
Information in this document applies to any platform.

PURPOSE

Guide to diagnosing the cause of a MySQL Server freeze, stall or similar interruption to service.

TROUBLESHOOTING STEPS

This document is a work in progress with only limited content at this stage. You should open a service request if it does not provide sufficient information to resolve your problem.

This does not cover actual crashes of the MySQL server. Check your running process list using operating system tools like PS or Task Manager. If you see that mysqld is still running this is the guide for you. If it is not still running, check a 
guide to actual crashes.

1. Check query cache free blocks count.

 

SHOW GLOBAL STATUS LIKE 'qcache_free_blocks';
+-------------------------+-------+
| Variable_name           | Value |
+-------------------------+-------+
| Qcache_free_blocks      | 120045|
+-------------------------+-------+



If you see a value above 10,000 it is likely that you need to tune your query cache settings. If you see a value above 50,000 it is possible that removing entries from the query cache could be blocking queries from running. Check for query cache related entries in SHOW PROCESSLIST output. Depending on MySQL server version and the number of free entries the delays could be as much as several minutes. More recent versions bypass the query cache once a timeout expires. As a temporary measure use FLUSH QUERY CACHE to defragment the query cache. It may take several minutes to work. As a longer term solution, see the query cache tuning guide (not yet available). Note that the query cache was designed for sizes of a few megabytes to a few tens of megabytes. Larger sizes than those can have serious adverse performance consequences.

You may also see high CPU use on one CPU core if the query cache is the source of the problem. The query cache only uses one core.

2. If using InnoDB, check SHOW ENGINE INNODB STATUS.


Look at the end of the list of transactions for queries that have been running for many tens, hundreds or thousands of seconds. If you see many such queries, decide whether you can safely KILL them and do that until the problem is resolved. Then work on tuning the queries and setting innodb_thread_concurrency and innodb_concurrency_tickets appropriately.

3. Check SHOW PROCESSLIST and search the knowledge base for the text of the values in the State column.


Many of the states can indicate potential trouble sources and solutions.

4. Open a service request.


Tell us the symptoms, whether it was sudden and whether it has been happening regularly. We will also need this output:
 

SHOW PROCESSLIST;
SHOW ENGINE INNODB STATUS;


Both taken while the problem is happening.
Both a second time a minute or so later, ideally still during the problem. If it is ongoing, repeat a few times with a ten or so minute gap between runs.

 

SHOW VARIABLES;
SHOW GLOBAL STATUS;


Also provide the most recent few thousand lines of the MySQL error log. Do not just start when the problem started, we need at least a  few hundred lines before then, if those lines exist. Going back more than a few days is not necessary.

For longer term monitoring we may ask you to turn on the InnoDB monitor. This regularly writes InnoDB status information to the MySQL Server error log file (usually called <servername>.err in the MySQL data directory. This is useful for monitoring batch jobs or over time to catch periodic problems. To enable it enter this in the client mysql:

 

USE TEST;
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;



To disable it after collecting data use:
 

USE TEST;
DROP TABLE innodb_monitor;

 

这篇关于Diagnosing MySQL Server Freezes and Stalls, Sometimes Called Crashes的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/222222

相关文章

Ubuntu中远程连接Mysql数据库的详细图文教程

《Ubuntu中远程连接Mysql数据库的详细图文教程》Ubuntu是一个以桌面应用为主的Linux发行版操作系统,这篇文章主要为大家详细介绍了Ubuntu中远程连接Mysql数据库的详细图文教程,有... 目录1、版本2、检查有没有mysql2.1 查询是否安装了Mysql包2.2 查看Mysql版本2.

基于SpringBoot+Mybatis实现Mysql分表

《基于SpringBoot+Mybatis实现Mysql分表》这篇文章主要为大家详细介绍了基于SpringBoot+Mybatis实现Mysql分表的相关知识,文中的示例代码讲解详细,感兴趣的小伙伴可... 目录基本思路定义注解创建ThreadLocal创建拦截器业务处理基本思路1.根据创建时间字段按年进

Python3.6连接MySQL的详细步骤

《Python3.6连接MySQL的详细步骤》在现代Web开发和数据处理中,Python与数据库的交互是必不可少的一部分,MySQL作为最流行的开源关系型数据库管理系统之一,与Python的结合可以实... 目录环境准备安装python 3.6安装mysql安装pymysql库连接到MySQL建立连接执行S

MySQL双主搭建+keepalived高可用的实现

《MySQL双主搭建+keepalived高可用的实现》本文主要介绍了MySQL双主搭建+keepalived高可用的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,... 目录一、测试环境准备二、主从搭建1.创建复制用户2.创建复制关系3.开启复制,确认复制是否成功4.同

MyBatis 动态 SQL 优化之标签的实战与技巧(常见用法)

《MyBatis动态SQL优化之标签的实战与技巧(常见用法)》本文通过详细的示例和实际应用场景,介绍了如何有效利用这些标签来优化MyBatis配置,提升开发效率,确保SQL的高效执行和安全性,感... 目录动态SQL详解一、动态SQL的核心概念1.1 什么是动态SQL?1.2 动态SQL的优点1.3 动态S

Mysql表的简单操作(基本技能)

《Mysql表的简单操作(基本技能)》在数据库中,表的操作主要包括表的创建、查看、修改、删除等,了解如何操作这些表是数据库管理和开发的基本技能,本文给大家介绍Mysql表的简单操作,感兴趣的朋友一起看... 目录3.1 创建表 3.2 查看表结构3.3 修改表3.4 实践案例:修改表在数据库中,表的操作主要

mysql出现ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost‘ (10061)的解决方法

《mysql出现ERROR2003(HY000):Can‘tconnecttoMySQLserveron‘localhost‘(10061)的解决方法》本文主要介绍了mysql出现... 目录前言:第一步:第二步:第三步:总结:前言:当你想通过命令窗口想打开mysql时候发现提http://www.cpp

MySQL大表数据的分区与分库分表的实现

《MySQL大表数据的分区与分库分表的实现》数据库的分区和分库分表是两种常用的技术方案,本文主要介绍了MySQL大表数据的分区与分库分表的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有... 目录1. mysql大表数据的分区1.1 什么是分区?1.2 分区的类型1.3 分区的优点1.4 分

MySQL错误代码2058和2059的解决办法

《MySQL错误代码2058和2059的解决办法》:本文主要介绍MySQL错误代码2058和2059的解决办法,2058和2059的错误码核心都是你用的客户端工具和mysql版本的密码插件不匹配,... 目录1. 前置理解2.报错现象3.解决办法(敲重点!!!)1. php前置理解2058和2059的错误

Mysql删除几亿条数据表中的部分数据的方法实现

《Mysql删除几亿条数据表中的部分数据的方法实现》在MySQL中删除一个大表中的数据时,需要特别注意操作的性能和对系统的影响,本文主要介绍了Mysql删除几亿条数据表中的部分数据的方法实现,具有一定... 目录1、需求2、方案1. 使用 DELETE 语句分批删除2. 使用 INPLACE ALTER T