Binlog processing method of MySQL data

Source: Internet
Author: User

The recent disk growth was very fast and found that the Binlog log occupies a large disk resource. We use manual cleanup and set up automatic cleanup later.

View the specified delete log

MySQL >show binary logs; See how much binlog logs, how much space is occupied.

Mysql> PURGE MASTER LOGS to ' mysql-bin.002467 '; Delete mysql-bin.002467 all previous binlog so that the *.index information is synchronized with the Binlog file.

Manual cleanup

Mysql>purge MASTER LOGS before Date_sub (current_date, INTERVAL 5 day); Manually delete the Binlog log 5 days ago

Automatic Setup Cleanup

mysql> Set Global expire_logs_days = 5; Set the expiration time of Binlog to 5 days;
mysql> flush logs; Swipe log to make the above settings effective, otherwise it will not take effect.

To ensure that it is still valid after MySQL restart, this parameter setting is also added in MY.CNF

Expire_logs_days = 5

This article is from the "Fly Hung 膤" blog, please be sure to keep this source http://jxzhfei.blog.51cto.com/1382161/1538466

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.