Specific methods
Before deleting a log, check the log files currently used by the master-slave server.
First log on the MySQL terminal of the server to which you want to delete logs
#mysql-U root-pxxxxx
Check Replication master server status
Mysql>show Master Status
+------------------+-----------+--------------+----------------------------------------+
| File | Position | binlog_do_db | binlog_ignore_db |
+------------------+-----------+--------------+----------------------------------------+
| mysql-bin.000097 | 541677824 | www | Test,mysql,information_schema |
+------------------+-----------+--------------+----------------------------------------+
The log file currently in use by the replication master server is: mysql-bin.000097
Check replication from server state
Mysql>show slave STATUSG
1. Row ***************************
Slave_io_state:waiting for Master to send event
master_host:202.102.152.3
Master_user:replication
master_port:3306
Connect_retry:60
master_log_file:mysql-bin.000103
read_master_log_pos:675107897
relay_log_file:www-relay-bin.000443
relay_log_pos:675097929
relay_master_log_file:mysql-bin.000103
Slave_io_running:yes
Slave_sql_running:yes
Replicate_do_db:www
Replicate_ignore_db:test,mysql,information_schema
Replicate_do_table:
Replicate_ignore_table:
Replicate_wild_do_table:
Replicate_wild_ignore_table:
last_errno:0
Last_error:
skip_counter:0
exec_master_log_pos:675107897
relay_log_space:675098125
Until_condition:none
Until_log_file:
until_log_pos:0
Master_ssl_allowed:no
Master_ssl_ca_file:
Master_ssl_ca_path:
Master_ssl_cert:
Master_ssl_cipher:
Master_ssl_key:
seconds_behind_master:0
Master_ssl_verify_server_cert:no
last_io_errno:0
Last_io_error:
last_sql_errno:0
Last_sql_error:
Replication master server log files that are currently in use from the server are replicated: mysql-bin.000103
The log file currently in use is 000097 and all I need to do is delete all the logs before No. 00095 (set aside the log for the last few days)
Mysql>purge master logs to ' mysql-bin.000095;
#ll/usr/local/mysql/var/
From the results, all the logs before number 000097 have been deleted
If there are other servers that need to clean up the logs, you can do so again in the order in which they are