MySQL Delete redundant bin-log files

Source: Internet
Author: User
Tags mysql delete

Today work found Zabbix alarm, open the alarm page looked down, said the server/partition is less than 20%.

SSH to server, view results found to be MySQL Bin-log file resulting in usage less than 20%

MYSQL> SYSTEM LS -LHTOTAL 8.5G-RW-RW---- 1 mysql mysql 1.6G  MAY 21 10:09 IBDATA1-RW-RW---- 1 mysql mysql 5.0M May 21  10:09 IB_LOGFILE0-RW-RW---- 1 mysql mysql 5.0m may 21 10:09 ib_ LOGFILE1DRWX------ 2 mysql root  4.0K Sep 15  2014  MYSQL-RW-RW---- 1 mysql mysql 1.1G Feb 13 20:43  MYSQL-BIN.000016-RW-RW---- 1 mysql mysql 1.1G Mar  3 14:37  MYSQL-BIN.000017-RW-RW---- 1 mysql mysql 1.1G Mar 20 04:18  MYSQL-BIN.000018-RW-RW---- 1 mysql mysql 1.1G Apr  4 19:29  MYSQL-BIN.000019-RW-RW---- 1 mysql mysql 1.1G Apr 20 15:57  MYSQL-BIN.000020-RW-RW---- 1 MYSQL MYSQL 1.1G MAY  6 15:30 MYSQL-BIN.000021-RW-RW---- 1 mysql mysql 967M May 21  10:09 MYSQL-BIN.000022-RW-RW---- 1 mysql mysql  133 may 21 10:09  MYSQL-BIN.INDEXDRWX------ 2 mysql mysql 4.0K Sep 15  2014  Performance_schema-rw-r----- 1 mysql root   43k may 21 10:09  STAGING-SLAVE.ERR-RW-RW---- 1 mysql mysql    5 Oct 26   2014 STAGING-SLAVE.PIDDRWX------ 2 mysql mysql 4.0k jan 23 09:44  zabbixmysql> system df -hFilesystem      Size   used avail use% mounted on/dev/xvda1       20g    15G  4.3G  78% /tmpfs            1.9g     0  1.9g   0% /dev/shm# Delete mysql-bin.000022 before Bin-log file mysql> purge master logs to  ' mysql-bin.000022 '; query ok, 0 rows affected  (0.38 sec) mysql> show master status; +------------------+------------+--------------+------------------+| file              | position   | binlog_do_db |  binlog_ignore_db |+------------------+------------+--------------+------------------+|  mysql-bin.000022 | 1013605244 |               |                   |+------------------+------------+--------------+------------------+1 row in  set  (0.00 sec) MYSQL> SYSTEM LS -LHTOTAL 2.5G-RW-RW---- 1 mysql mysql 1.6G May 21 10:44  IBDATA1-RW-RW---- 1 mysql mysql 5.0m may 21 10:44 ib_ LOGFILE0-RW-RW---- 1 mysql mysql 5.0m may 21 10:24 ib_ LOGFILE1DRWX------ 2 mysql root  4.0K Sep 15  2014  MYSQL-RW-RW---- 1 mysql mysql 969M May 21 10:44  MYSQL-BIN.000022-RW-RW---- 1 mysql mysql   19 May 21 10:09  MYSQL-BIN.INDEXDRWX------ 2 mysql mysql 4.0K Sep 15  2014  Performance_schema-rw-r----- 1 mysql root   43k may 21 10:09  STAGING-SLAVE.ERR-RW-RW---- 1 mysql mysql    5 Oct 26   2014 STAGING-SLAVE.PIDDRWX------ 2 mysql mysql 4.0k jan&Nbsp;23 09:44 zabbix 


This article is from the "ly36843" blog, please be sure to keep this source http://ly36843.blog.51cto.com/3120113/1653431

MySQL Delete redundant bin-log files

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.