主库的空间占用很大,发现OA数据目录下大力的binlog文件很多,在服务器巡检过程中发现磁盘空间被大量的占用,登录从库发现实际的数据量不大,应该是其他文件所占用,在主库的数据目录下发现大量的mysql-bin.xxxxx文件,该目录下大概有500个类似这样的文件;
[[email protected] oadata]# pwd
/dbdata/oadata
[[email protected] oadata]# du -m mysql-bin.000418
1026 mysql-bin.000418
登录库
mysql -u root -pxxxxx
mysql> show binary logs;
...........................................................
| mysql-bin.000563 | 1073916143 |
| mysql-bin.000564 | 1074472268 |
| mysql-bin.000565 | 810491102 |
+------------------+------------+
565 rows in set (0.00 sec)
mysql> select CURRENT_DATE;
+--------------+
| CURRENT_DATE |
+--------------+
| 2016-06-27 |
+--------------+
1 row in set (0.01 sec)
mysql> PURGE MASTER LOGS BEFORE DATE_SUB(CURRENT_DATE, INTERVAL 10 DAY);
Query OK, 0 rows affected (13.40 sec)
mysql> SHOW master logs;
............................................
| mysql-bin.000564 | 1074472268 |
| mysql-bin.000565 | 810510482 |
+------------------+------------+
42 rows in set (0.00 sec)
磁盘空间被大量的释放出来!