mysql 数据库缓存调优之解决The total number of locks exceeds the lock table size错误
环境:
mysql5.6.2 主从同步(备注:需操作主库和从库)
一、InnoDB表执行大批量数据的更新,插入,删除操作时会出现这个问题,需要调整InnoDB全局的innodb_buffer_pool_size的值来解决这个问题,并且重启mysql服务。
遇到的问题:
mysql报错如下:
The total number of locks exceeds the lock table size错误
二、解决办法
2.1、登录主库查看buffer_pool_size大小
[root@a2 ~]# mysql -uroot -p (备注:主库)
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 54
Server version: 5.6.24 Source distribution Copyright (c) 2000, 2015, 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数据库buffer_pool大小为:8MB
mysql> show variables like "%_buffer%";
+-------------------------------------+----------------+
| Variable_name | Value |
+-------------------------------------+----------------+
| innodb_buffer_pool_size | 8388608 |
22 rows in set (0.00 sec) 需要调优为:2G-3G
2.2、调优方法
#关闭数据库(备注:主从同步状态正常的情况下关闭主库)
[root@a1 mysql]# /etc/init.d/mysqld stop
Shutting down MySQL........... SUCCESS!
#修改配置文件 (备注:在主库上面修改配置文件)
[root@a1 mysql]# vi /roobo/server/mysql/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
#[client]
#port = 3306
#socket = /tmp/mysql.sock
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysqld.pid
default-character-set = utf8 [mysqld]
port = 3306
socket = /tmp/mysql.sock
#innodb_buffer_pool_size=8MB #原文件
innodb_buffer_pool_size=2GB #修改为2G或 3G,根据表大小,进行调优。
basedir = /roobo/server/mysql
datadir = /roobo/mysqldata/database
pid-file = /var/lib/mysql/mysql.pid
character_set_server = utf8
log-bin = /roobo/server/mysql/data/mysql-bin
server_id = 1
#启动数据库 (备注:在主库上面操作)
[root@a1 mysql]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
#再登录数据库检查是否修改成功 (备注:在主库上面操作)
[root@a1 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.24-log Source distribution Copyright (c) 2000, 2015, 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.
#修改成2G
mysql> show variables like "%_buffer%";
+-------------------------------------+----------------+
| Variable_name | Value |
+-------------------------------------+----------------+
| bulk_insert_buffer_size | 8388608 |
| innodb_buffer_pool_dump_at_shutdown | OFF |
| innodb_buffer_pool_dump_now | OFF |
| innodb_buffer_pool_filename | ib_buffer_pool |
| innodb_buffer_pool_instances | 8 |
| innodb_buffer_pool_load_abort | OFF |
| innodb_buffer_pool_load_at_startup | OFF |
| innodb_buffer_pool_load_now | OFF |
| innodb_buffer_pool_size | 2147483648 |
| innodb_change_buffer_max_size | 25 |
| innodb_change_buffering | all |
| innodb_log_buffer_size | 8388608 |
| innodb_sort_buffer_size | 1048576 |
| join_buffer_size | 262144 |
| key_buffer_size | 8388608 |
| myisam_sort_buffer_size | 8388608 |
| net_buffer_length | 16384 |
| preload_buffer_size | 32768 |
| read_buffer_size | 131072 |
| read_rnd_buffer_size | 262144 |
| sort_buffer_size | 262144 |
| sql_buffer_result | OFF |
+-------------------------------------+----------------+
22 rows in set (0.00 sec) mysql> exit
#备注:从库也要调优相同参数,否则会导致数据库主从不同步
#关闭数据库(备注:主从同步状态正常的情况下关闭从库)
[root@a2 mysql]# /etc/init.d/mysqld stop
Shutting down MySQL........... SUCCESS!
#修改配置文件 (备注:在从库上面修改配置文件)
[root@a2 mysql]# vi my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
#[client]
#port = 3306
#socket = /tmp/mysql.sock
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysqld.pid
default-character-set = utf8
[mysqld]
port = 3306
socket = /tmp/mysql.sock
#innodb_buffer_pool_size=8MB
innodb_buffer_pool_size=2GB #把8M修改成2G
basedir = /roobo/server/mysql
datadir = /roobo/mysqldata/database
pid-file = /var/lib/mysql/mysql.pid
character_set_server = utf8
server-id = 2
read_only = 1
#启动数据库 (备注:在从主库上面操作)
[root@a2 mysql]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
#再登录数据库检查是否修改成功 (备注:在从库上面操作)
[root@a2 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.24-log Source distribution Copyright (c) 2000, 2015, 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.
#修改成2G
mysql> show variables like "%_buffer%";
+-------------------------------------+----------------+
| Variable_name | Value |
+-------------------------------------+----------------+
| bulk_insert_buffer_size | 8388608 |
| innodb_buffer_pool_dump_at_shutdown | OFF |
| innodb_buffer_pool_dump_now | OFF |
| innodb_buffer_pool_filename | ib_buffer_pool |
| innodb_buffer_pool_instances | 8 |
| innodb_buffer_pool_load_abort | OFF |
| innodb_buffer_pool_load_at_startup | OFF |
| innodb_buffer_pool_load_now | OFF |
| innodb_buffer_pool_size | 2147483648 |
| innodb_change_buffer_max_size | 25 |
| innodb_change_buffering | all |
| innodb_log_buffer_size | 8388608 |
| innodb_sort_buffer_size | 1048576 |
| join_buffer_size | 262144 |
| key_buffer_size | 8388608 |
| myisam_sort_buffer_size | 8388608 |
| net_buffer_length | 16384 |
| preload_buffer_size | 32768 |
| read_buffer_size | 131072 |
| read_rnd_buffer_size | 262144 |
| sort_buffer_size | 262144 |
| sql_buffer_result | OFF |
+-------------------------------------+----------------+
22 rows in set (0.00 sec) mysql> exit
#再登录从库,查看主从同步情况 (备注:在从库上面操作)
[root@a2 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 55
Server version: 5.6.24 Source distribution Copyright (c) 2000, 2015, 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> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.7.19.129
Master_User: rep
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000015
Read_Master_Log_Pos: 67365
Relay_Log_File: mysql-relay-bin.000036
Relay_Log_Pos: 67528
Relay_Master_Log_File: mysql-bin.000015
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
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: 67365
Relay_Log_Space: 67864
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: 1
Master_UUID: 4afce67d-d694-11e8-94c2-00163e0a2eec
Master_Info_File: /roobo/mysqldata/database/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec) ERROR:
No query specified mysql> exit
Bye
mysql 数据库缓存调优之解决The total number of locks exceeds the lock table size错误的更多相关文章
- Mysql_解决The total number of locks exceeds the lock table size错误
在操作mysql数据库表时出现以下错误. 网上google搜索相关问题,发现一位外国牛人这么解释: If you're running an operation on a large number o ...
- 解决The total number of locks exceeds the lock table size错误
参考:https://blog.csdn.net/weixin_40683253/article/details/80762583 mysql在进行大批量的数据操作时,会报“The total num ...
- 【转】Mysql解决The total number of locks exceeds the lock table size错误
InnoDB表执行大批量数据的更新,插入,删除操作时会出现这个问题,需要调整InnoDB全局的innodb_buffer_pool_size的值来解决这个问题,并且重启mysql服务. windows ...
- MySQL插入大批量数据时报错“The total number of locks exceeds the lock table size”的解决办法
事情的原因是:我执行了一个load into语句的SQL将一个很大的文件导入到我的MySQL数据库中,执行了一段时间后报错"The total number of locks exceeds ...
- MySQL解决[Err] 1206 - The total number of locks exceeds the lock table size问题
MySQL解决[Err] 1206 - The total number of locks exceeds the lock table size问题 查看MySQL版本:mysql>show ...
- 【MySQL笔记】mysql报错"ERROR 1206 (HY000): The total number of locks exceeds the lock table size"的解决方法
step1:查看 1.1 Mysql命令行里输入"show engines:"查看innoddb数据引擎状态, 1.2 show variables "%_buffer% ...
- mysql报错"ERROR 1206 (HY000): The total number of locks exceeds the lock table size"的解决方法
1. 问题背景 InnoDB是新版MySQL(v5.5及以后)默认的存储引擎,之前版本的默认引擎为MyISAM,因此,低于5.5版本的mysql配置文件.my.cnf中,关于InnoD ...
- MYSQL 遭遇 THE TOTAL NUMBER OF LOCKS EXCEEDS THE LOCK TABLE SIZE
今天进行MySql 一个表数据的清理,经过漫长等待后出现 The total number of locks exceeds the lock table size 提示.以为是table_cache ...
- mysql:The total number of locks exceeds the lock table size
使用mysql InnoDB存储引擎进行大量数据的更新,删除的时候容易引发”The total number of locks exceeds the lock table size”问题,解决方法之 ...
随机推荐
- HDU 3045 picnic cows(斜率DP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3045 题目大意:有n个数,可以把n个数分成若干组,每组不得小于m个数,每组的价值=除了该组最小值以外每 ...
- LeetCode239. Sliding Window Maximum
Given an array nums, there is a sliding window of size k which is moving from the very left of the a ...
- Bootstrap框架的简介
一.Bootstrap介绍 Bootstrap是Twitter开源的基于HTML.CSS.JavaScript的前端框架. 它是为实现快速开发Web应用程序而设计的一套前端工具包. 它支持响应式布局, ...
- JSON-lib的api的使用
List<Object> list = new ArrayList<Object>(); Map<String,Object> map1 = new HashMap ...
- Android与html5交互 -- WebView使用(一)
Android中使用WebView可加载html5,具体步骤如下: (前提:本地Html5存放到assets文件夹下) 一:使用WebView加载Html5,简单显示 1:清单文件中添加访问权限:an ...
- SGU 202. The Towers of Hanoi Revisited
多柱汉诺塔问题. 引用自wiki百科 多塔汉诺塔问题 在有3个柱子时,所需步数的公式较简单,但对于4个以上柱子的汉诺塔尚未得到通用公式,但有一递归公式(未得到证明,但目前为止没有找到反例): 令为在有 ...
- windows10 自带的OpenSSH Client(Beta)
我不知道其他版本有没有 ,我是windows10 专业版,版本1709,OS内部版本16288.1 安装过程: 1.我的电脑上面的卸载或更改程序 2.管理可选功能 3.添加功能 4.重启电脑,搞定 O ...
- loadrunner测试TCP协议服务器性能
loadrunner测试TCP协议服务器性能 . 性能loadrunner测试c 最近对服务器的性能感兴趣,于是开始研究了一阵子loadrunner如何做采用TCP协议交互的服务器的性能测试,对loa ...
- lr计算程序执行消耗时间的比较:
去除程序执行的两种方式: 1.通过一个事务:在需要消除的代码段,使用lr_wasted_time(wasteTime); querySubmit() { char newStr4[10000]=&qu ...
- 关于在windows下部署发布QT程序的总结
原文请看:http://www.cnblogs.com/javaexam2/archive/2011/05/18/2632916.html 关于在windows下部署发布QT程序的总结 2008-06 ...