在恢复周一的增量备份
[root@fxstest1 20060902-20020908]#time /usr/local/mysql/bin/mysql -f -uroot mysqlafx < <(/usr/local/mysql/bin/mysqlbinlog 5a-s03-a3-bin.000141 5a-s03-a3-bin.000142) &>/dev/null &
=======================================================
mysqlbinlog的日常维护
查看下磁盘空间已经到81%
[mfx@5a-s03-a3 data]$ df -H
Filesystem Size Used Avail Use% マウント疤弥
/dev/cciss/c0d0p2 64G 49G 12G 81% /
none 4.3G 0 4.3G 0% /dev/shm
查看下备份数据库binlog
[mfx@5a-s03-a3 20070208]$ ll
圭纷 315908
-rw-r--r-- 1 mfx mfx 323164392 2奉 8 06:50 MySQLDB20070208064502.tar.gz
[mfx@5a-s03-a3 20070208]$
[mfx@5a-s03-a3 20070208]$
[mfx@5a-s03-a3 20070208]$ tar -tzvf MySQLDB20070208064502.tar.gz
-rw-rw---- mysql/mysql 1073742006 2007-02-07 20:09:19 usr/local/mysql/data/5a-s03-a3-bin.000603
-rw-rw---- mysql/mysql 1073742501 2007-02-07 17:28:57 usr/local/mysql/data/5a-s03-a3-bin.000602
-rw-rw---- mysql/mysql 1073742008 2007-02-07 10:47:29 usr/local/mysql/data/5a-s03-a3-bin.000600
-rw-rw---- mysql/mysql 1073742300 2007-02-07 14:36:20 usr/local/mysql/data/5a-s03-a3-bin.000601
-rw-rw---- mysql/mysql 1073742310 2007-02-08 03:19:20 usr/local/mysql/data/5a-s03-a3-bin.000605
-rw-rw---- mysql/mysql 1073742254 2007-02-07 23:21:41 usr/local/mysql/data/5a-s03-a3-bin.000604
-rw-rw---- mysql/mysql 971134539 2007-02-08 06:46:52 usr/local/mysql/data/5a-s03-a3-bin.000606
[mfx@5a-s03-a3 data]$ ll
圭纷 8812756
-rw-rw---- 1 mysql mysql 1073742008 2奉 7 10:47 5a-s03-a3-bin.000600
-rw-rw---- 1 mysql mysql 1073742300 2奉 7 14:36 5a-s03-a3-bin.000601
-rw-rw---- 1 mysql mysql 1073742501 2奉 7 17:28 5a-s03-a3-bin.000602
-rw-rw---- 1 mysql mysql 1073742006 2奉 7 20:09 5a-s03-a3-bin.000603
-rw-rw---- 1 mysql mysql 1073742254 2奉 7 23:21 5a-s03-a3-bin.000604
-rw-rw---- 1 mysql mysql 1073742310 2奉 8 03:19 5a-s03-a3-bin.000605
-rw-rw---- 1 mysql mysql 971134539 2奉 8 06:46 5a-s03-a3-bin.000606
-rw-rw---- 1 mysql mysql 1073742385 2奉 8 10:21 5a-s03-a3-bin.000607
-rw-rw---- 1 mysql mysql 507000664 2奉 8 11:56 5a-s03-a3-bin.000608
-rw-rw---- 1 mysql mysql 207 2奉 8 10:21 5a-s03-a3-bin.index
-rw-rw---- 1 mysql mysql 597 6奉 5 2006 5a-s03-a3-relay-bin.000004
-rw-rw---- 1 mysql mysql 29 6奉 5 2006 5a-s03-a3-relay-bin.index
-rw-rw---- 1 mysql root 26379 7奉 21 2006 5a-s03-a3.data-hotel.net.err
-rw-rw---- 1 mysql mysql 5 7奉 21 2006 5a-s03-a3.data-hotel.net.pid
-rw-rw---- 1 mysql mysql 5242880 2奉 8 11:55 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 2奉 8 11:56 ib_logfile1
-rw-rw---- 1 mysql mysql 10485760 2奉 8 11:55 ibdata1
drwxr-x--- 2 mysql mysql 4096 8奉 19 2005 mysql
drwx------ 2 mysql mysql 12288 6奉 30 2006 mysqlafx
drwxr-x--- 2 mysql mysql 4096 3奉 6 2005 test
对已经备份的binlog进行删除
[mfx@5a-s03-a3 data]$ /usr/local/mysql/bin/mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 48716 to server version: 4.1.10a-max-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show master logs;
+----------------------+
| Log_name |
+----------------------+
| 5a-s03-a3-bin.000600 |
| 5a-s03-a3-bin.000601 |
| 5a-s03-a3-bin.000602 |
| 5a-s03-a3-bin.000603 |
| 5a-s03-a3-bin.000604 |
| 5a-s03-a3-bin.000605 |
| 5a-s03-a3-bin.000606 |
| 5a-s03-a3-bin.000607 |
| 5a-s03-a3-bin.000608 |
+----------------------+
9 rows in set (0.00 sec)
mysql> purge master logs to '5a-s03-a3-bin.000606';
Query OK, 0 rows affected (7.86 sec)
mysql> show master logs;
+----------------------+
| Log_name |
+----------------------+
| 5a-s03-a3-bin.000606 |
| 5a-s03-a3-bin.000607 |
| 5a-s03-a3-bin.000608 |
+----------------------+
3 rows in set (0.00 sec)
mysql> \q
Bye
[mfx@5a-s03-a3 data]$ df
Filesystem 1K-ブロック 蝗脱 蝗脱材 蝗脱% マウント疤弥
/dev/cciss/c0d0p2 62120100 41368736 17595800 71% /
none 4124032 0 4124032 0% /dev/shm