当前位置:网站首页>MySQL binlog cleanup
MySQL binlog cleanup
2022-07-01 23:16:00 【undo_ try】
Linux Disk space is full solution
Query the overall disk usage command
df -h
* / df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs 3.8G 393M 3.5G 11% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/vda1 40G 30G 7.2G 81% /
tmpfs 777M 0 777M 0% /run/user/1000
Query the size of each folder or file in a directory
sudo du -sh *
* / sudo du -sh *
0 bin
211M boot
...
2.2G usr
26G var
Then enter /var Under the table of contents , Continue to use this command to view , Found to be binlog Too much leads to , You need to remove binlog journal .
clear mysql binlog
mysql Of binlog essential , But if you don't clean it up , Xiaoyun disk can't stand frequent insertion and deletion every day . therefore binlog The log needs to be deleted .
mysql> show variables like ‘%expire%’;

After querying the above parameters, it is found that MySQL 8.0.12 On by default in the version binlog Log and set to binlog_format=row,binlog The expiration date parameter is binlog_expire_logs_seconds, Default 30 Days overdue .
notes :
stay MySQL8.0 New parameter in version binlog_expire_logs_seconds, It can be accurate to seconds , In previous versions expire_logs_days In days , The minimum value is 1, stay MySQL8.0 GA This parameter is marked as deprecated .
stay MySQL 8.0 GA Version default use binlog_expire_logs_seconds, Time is 2592000 second ,30 God .
- If in MySQL Startup time
inlog_expire_logs_secondsandexpire_logs_daysThere is no set value , The default value is usedbinlog_expire_logs_secondsvalue , namely 30 God ; - If in MySQL Startup time
binlog_expire_logs_secondsperhapsexpire_logs_daysOne of them is set to non 0 Value is not 0 Value as binlog Log expiration date ; - If at startup
binlog_expire_logs_secondsandexpire_logs_daysAll parameters are set to non 0 Value is usedbinlog_expire_logs_secondsvalue ,expire_logs_daysValue is invalid and an alarm message is sent .
To turn off auto clear binlog The function of the file needs to display the specified binlog_expire_logs_seconds=0 And don't set expire_logs_days Value .
In order to be compatible with previous versions, if the display specifies expire_logs_days =0 There is no designation binlog_expire_logs_seconds Value , Automatic cleaning at this time binlog The log is Ban Of , And at this point binlog_expire_logs_seconds The default value of does not apply .
Delete log manually
Manual cleaning certainly does not mean rm -rf ** , This may lead to binlog.index Disorder .
mysql -uroot -p # land mysql
show binary logs; # view log file
show master status; # View the log file being used :binlog.000015
purge binary logs to 'binlog.000015'; # Delete binlog.000015 Log files other than files
Set expiration time
Set expiration 48 Hours
mysql> set global binlog_expire_logs_seconds=60*60*48;
mysql> flush logs; # Brush it. log Make the above settings work , Otherwise it doesn't work . Be careful : Restart this configuration mysql Post failure .
边栏推荐
- Zhongang Mining: it has inherent advantages to develop the characteristic chemical industry dominated by fluorine chemical industry
- Detailed explanation of twenty common software testing methods (the most complete in History)
- [micro service sentinel] sentinelresourceaspect details
- Zhao Fuquan: to ensure supply in the short term, we should build a safe, efficient and resilient supply chain in the long term
- 思科考试--路由的概念和配置考试
- 2022安全员-C证考试题模拟考试题库及模拟考试
- SWT/ANR问题--SWT 导致 kernel fuse deadlock
- Summary of "performance testing" of software testing, novice will know the knowledge points on the road
- 91. (cesium chapter) cesium rocket launch simulation
- 思科考试--冗余网络
猜你喜欢

window10安装wsl(一)(WslRegisterDistribution ERROR)
![Jielizhi, production line assembly link [chapter]](/img/5f/9ea7fd3b93df1fd3ecbfc1b669c831.png)
Jielizhi, production line assembly link [chapter]

Aaai22 | structural tagging and interaction modeling: a "slim" network for graph classification

实在RPA:银行数字化,业务流程自动化“一小步”,贷款审核效率“一大步”

YOGA27多维一体电脑,兼具出色外观与高端配置
![Jerry's burning of upper version materials requires [chapter]](/img/65/fcd804e00dc08a2bd056e8e6493829.png)
Jerry's burning of upper version materials requires [chapter]

CADD course learning (3) -- target drug interaction

The online beggar function of Japanese shopping websites

思科考试--路由的概念和配置考试

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received
随机推荐
Explain the use of locksupport in detail
AirServer最新Win64位个人版投屏软件
[MySQL] index classification
关于游戏性能优化的一些感想
软件测试之「 性能测试」总结,新手上路必会知识点
认识线程
[micro service sentinel] sentinel integrates openfeign
AAAI22 | 结构标记和交互建模:用于图分类的“SLIM”网络
The online beggar function of Japanese shopping websites
每日三题 6.29
2022 examination questions and online simulation examination for safety management personnel of hazardous chemical business units
Jielizhi Bluetooth headset quality control and production skills [chapter]
leetcode - 287. Find duplicates
typescript枚举
半监督学习之数据增强
ESP自动下载电路设计
Advanced skills of testers: a guide to the application of unit test reports
tcpdump命令使用详解
【微服务|Sentinel】@SentinelResource详解
想请教股票开户要认识谁?在线开户是安全么?