MySQL's binlog too much space-intensive solution

Source: Internet
Author: User

Phenomenon: Web site access is getting slower, finally inaccessible, after the check found that the disk is full

Analysis Process and solution: Usually this problem should be logged on to the server to check the disk, memory and process use, through top, df–h and free–m to check, found that the disk space is full. Further through the du–sh to the directory can be checked, found that MySQL Binlog occupied space is too large. Here's how to clean up Binlog: 1) Set log retention length expire_logs_days automatically deleteView current journal days saved:Show variables like '%expire_logs_days% ';The default is 0, which is logs, which can be temporarily applied by setting global parameters:set global expire_logs_days=7;set to keep only 7 days Binlog, the next time you restart mysql This parameter will fail by default, so you need to set it in My.cnfexpire_logs_days = 7 2) manually delete binlog (purge binary logs)used to delete all binary logs that are listed in the log index before the specified log or date. These logs are also logged from the log index filePURGE {MASTER | BINARY} LOGS to ' Log_name 'PURGE {MASTER | BINARY} LOGS before ' date 'For example:PURGE MASTER LOGS to ' mysql-bin.010 ';PURGE MASTER LOGS before ' 2008-06-22 13:00:00 ';PURGE MASTER LOGS before Date_sub (now (), INTERVAL 3 day);
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.