1 检查日志是否已全部应用:
mysql> show processlist;
+----+-------------+--------------------+------+---------+------+-----------------------------------------------------------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-------------+--------------------+------+---------+------+-----------------------------------------------------------------------+------------------+
| 1 | root | localhost | test | Query | 0 | NULL | show processlist |
| 4 | system user | | NULL | Connect | 345 | Waiting for master to send event | NULL |
| 5 | system user | | NULL | Connect | 295 | Has read all relay log; waiting for the slave I/O thread to update it | NULL |
| 7 | testuser | 192.168.1.100:1506 | NULL | Sleep | 122 | | NULL |
| 8 | testuser | 192.168.1.100:1507 | test | Sleep | 86 | | NULL |
| 9 | testuser | 192.168.1.100:1508 | test | Sleep | 29 | | NULL |
+----+-------------+--------------------+------+---------+------+-----------------------------------------------------------------------+------------------+
6 rows in set (0.00 sec)
2 停止slave,去掉readonly,reset slave:
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
CHANGE master TO master_host='';
mysql> SET global read_only=0;
Query OK, 0 rows affected (0.00 sec)
mysql> reset slave;
Query OK, 0 rows affected (0.04 sec)
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000004 | 869 | | |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
3 修改my.cnf 一些参数(可以考虑重启一下)
4 关于 reset slave:
RESET SLAVE [ALL]
RESET SLAVE makes the slave forget its replication position in the master's binary log. This statement is meant to be used for a clean start: It deletes the master.info and relay-log.info files, all the relay log files, and starts a new relay log file. To use RESET SLAVE, the slave replication threads must be stopped (use STOP SLAVE if necessary).
Note
All relay log files are deleted, even if they have not been completely executed by the slave SQL thread. (This is a condition likely to exist on a replication slave if you have issued a STOP SLAVE statement or if the slave is highly loaded.)
In MySQL 5.5 (unlike the case in MySQL 5.1 and earlier), RESET SLAVE does not change any replication connection parameters such as master host, master port, master user, or master password, which are retained in memory. This means that START SLAVE can be issued without requiring a CHANGE MASTER TO statement following RESET SLAVE.
In MySQL 5.5.16 and later, you can use RESET SLAVE ALL to reset these connection parameters (Bug #11809016). Connection parameters are also reset if the slave mysqld is shut down.
If the slave SQL thread was in the middle of replicating temporary tables when it was stopped, and RESET SLAVE is issued, these replicated temporary tables are deleted on the slave.
--转自