MYSQL主从复制GTID错误处理

复制出错 |  SQL类出错 



GTID的错误

1:SQL类错误(主键冲突、表存在等)


查看到出错的信息
mysql> show slave status\G;



				Last_SQL_Error: Error 'Can't drop database 'def'; database doesn't exist' on query. Default database: 'def'. Query: 'drop database  def'
				Replicate_Ignore_Server_Ids: 
				Master_Server_Id: 100
                                Master_UUID: 753cfe11-7cd2-11e8-935c-d05349b146f5
				Master_Info_File: /usr/local/mysql/data/master.info
                                SQL_Delay: 0
				SQL_Remaining_Delay: NULL
				Slave_SQL_Running_State: 
				Master_Retry_Count: 86400
                                Master_Bind: 
				Last_IO_Error_Timestamp: 
				Last_SQL_Error_Timestamp: 180704 16:12:27
				Master_SSL_Crl: 
				Master_SSL_Crlpath: 
				Retrieved_Gtid_Set: 753cfe11-7cd2-11e8-935c-d05349b146f5:1-16  #当前正在执行的
				Executed_Gtid_Set: 1da4862e-7ece-11e8-a4da-000c290de34b:1-5,   #已经执行过


mysql> show variables like '%gtid%';


mysql> stop slave;
mysql> set gtid_next='753cfe11-7cd2-11e8-935c-d05349b146f5:16';
mysql> begin;
mysql> commit;
mysql> set gtid_next='AUTOMATIC';
mysql> start slave;



GTID相关参数
gtid_executed				执行过的所有GTID
gtid_purged					丢弃掉的GTID
gtid_mode					gtid模式
gtid_next					session级别的变量,下一个gtid
gtid_owned					正在运行的gtid
enforce_gtid_consistency	保证GTID安全的参数



出现这个错误
Last_SQL_Error: Error 'Can't drop database 'def'; database doesn't exist' on query. Default database: 'def'. Query: 'drop database  def'
mysql> stop slave;
mysql> create database def;
mysql> start slave;






你可能感兴趣的:(MySQL)