PURGE BINARY LOGS
To safely purge binary log files, follow this procedure:
-
On each replica, use
SHOW SLAVE STATUS
to check which log file it is reading. -
Obtain a listing of the binary log files on the replication source server with
SHOW BINARY LOGS
. -
Determine the earliest log file among all the replicas. This is the target file. If all the replicas are up to date, this is the last log file on the list.
-
Make a backup of all the log files you are about to delete. (This step is optional, but always advisable.)
-
Purge all log files up to but not including the target file.
You can also set the expire_logs_days
system variable to expire binary log files automatically after a given number of days .
- 点赞
- 收藏
- 关注作者
评论(0)