mysql 删除多余的bin-log文件
今天上班发现zabbix报警,打开报警页面看了下,说的是服务器的/分区低于20%。
ssh到服务器上,查看结果发现是mysql的bin-log文件导致使用率低于20%
mysql> system ls -lh total 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_logfile1 drwx------ 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.index drwx------ 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.pid drwx------ 2 mysql mysql 4.0K Jan 23 09:44 zabbix mysql> system df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 20G 15G 4.3G 78% / tmpfs 1.9G 0 1.9G 0% /dev/shm #删除mysql-bin.000022之前的bin-log文件 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 -lh total 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_logfile1 drwx------ 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.index drwx------ 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.pid drwx------ 2 mysql mysql 4.0K Jan 23 09:44 zabbix
本文出自 “ly36843运维” 博客,请务必保留此出处http://ly36843.blog.51cto.com/3120113/1653431
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。