当前位置:网站首页>How to reduce the shutdown time of InnoDB database?
How to reduce the shutdown time of InnoDB database?
2022-07-06 12:48:00 【wx5caecf2ed0645】
We are using innodb When it comes to databases , You will find such a phenomenon , When we need to shut down or restart mysql In service , It will take quite a long time , If the database process shuts down abnormally , Opening the database will take a long time to recover .
At first, I thought the database was too large , Later I saw an article about “innodb_max_dirty_pages_pct Relationship with checkpoints ” , To understand the truth . The usual reason is from buffer pool Dirty page data exchange ,mysql Will inform OS, Exchange some dirty pages , The exchange is to modify in memory , Not on the hard disk .
If you need to shut down quickly innodb database , Then there is a way , as follows :
1, Set global variables , Set up innodb_max_dirty_pages_pct The value of the parameter .
mysql> set global innodb_max_dirty_pages_pct = 0;
2, Execute the following command , View the modified data page .
/usr/local/mysql/bin/mysqladmin -uroot -p ext -i10 | grep dirty
Enter password:
| Innodb_buffer_pool_pages_dirty | 4530 |
| Innodb_buffer_pool_pages_dirty | 4576 |
| Innodb_buffer_pool_pages_dirty | 4475 |
| Innodb_buffer_pool_pages_dirty | 4496 |
| Innodb_buffer_pool_pages_dirty | 4411 |
When this parameter becomes 0, Or close to 0( If your server is using , It won't become 0 Of ).
here , When this value is quite low , You can restart your database service , This is the time , You will find that the speed is quite fast .
Be careful :
This is the sum of innodb buffer It has a lot to do with it , It is generally not recommended to change this value , Unless it's yours innodb buffer It's big . I have 3 Database servers , One set 3G Of innodb buffer Dirty page data in 1000 about , The other is 1G Of innodb buffer Dirty page in 4000 about ,, It seems that innodb buffer The bigger the better !
Maybe you will say you can pass innodb_fast_shutdown This option adjusts the closing speed , The system defaults to 1, But if you change the value of this item to 0 perhaps 2,, In this way mysql It's dangerous .
The official description is as follows :
The InnoDB shutdown mode. By default, the value is 1, which causes a “fast” shutdown (the normal type of shutdown).
If the value is 0, InnoDB does a full purge and an insert buffer merge before a shutdown. These operations can take minutes, or even hours in extreme cases.
If the value is 1, InnoDB skips these operations at shutdown.
If the value is 2, InnoDB will just flush its logs and then shut down cold, as if MySQL had crashed; no committed transaction will be lost, but crash recovery will be done at the next startup. A value of 2 cannot be used on NetWare.
边栏推荐
- Combination of fairygui check box and progress bar
- (课设第一套)1-5 317号子任务 (100 分)(Dijkstra:重边自环)
- (一)R语言入门指南——数据分析的第一步
- idea中导包方法
- Expected value (EV)
- Gateway fails to route according to the service name, and reports an error service unavailable, status=503
- Prove the time complexity of heap sorting
- ESP8266连接onenet(旧版MQTT方式)
- What is the maximum length of MySQL varchar field
- About using @controller in gateway
猜你喜欢

In 2020, the average salary of IT industry exceeded 170000, ranking first

Particle system for introduction to unity3d Foundation (attribute introduction + case production of flame particle system)

MySQL时间、时区、自动填充0的问题

idea问题记录

Unity scene jump and exit

MySQL時間、時區、自動填充0的問題

数据库课程设计:高校教务管理系统(含代码)

Fairygui gain buff value change display

NRF24L01故障排查

Design and implementation of general interface open platform - (39) simple and crude implementation of API services
随机推荐
Halcon knowledge: gray_ Tophat transform and bottom cap transform
程序设计大作业:教务管理系统(C语言)
CUDA C programming authoritative guide Grossman Chapter 4 global memory
VLSM variable length subnet mask partition tips
How to add music playback function to Arduino project
First use of dosbox
Devops' future: six trends in 2022 and beyond
[offer78]合并多个有序链表
Get the position of the nth occurrence of the string
rtklib单点定位spp使用抗差估计遇到的问题及解决
Force buckle 1189 Maximum number of "balloons"
2021.11.10汇编考试
Classification, understanding and application of common methods of JS array
单片机蓝牙无线烧录
idea问题记录
Combination of fairygui check box and progress bar
FairyGUI增益BUFF數值改變的顯示
@Autowired 和 @Resource 的区别
The service robots that have been hyped by capital and the Winter Olympics are not just a flash in the pan
第一人称视角的角色移动