gtid 同步1050异常处理

[root@dba_test_002 ~]# cat  2.sql
CREATE TABLE `fudao_student_lable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) unsigned NOT NULL COMMENT '学员id',
`tid` int(11) unsigned NOT NULL DEFAULT '' COMMENT '老师id',
PRIMARY KEY (`id`),
KEY `index_tid` (`tid`),
KEY `index_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学员关系表'; # 在从库中创建一个表
mysql> set sql_log_bin=0;
Query OK, 0 rows affected (0.00 sec) mysql> CREATE TABLE `fudao_student_lable` (
-> `id` int(11) NOT NULL AUTO_INCREMENT,
-> `uid` int(11) unsigned NOT NULL COMMENT '学员id',
-> `tid` int(11) unsigned NOT NULL DEFAULT '' COMMENT '老师id',
-> PRIMARY KEY (`id`),
-> KEY `index_tid` (`tid`),
-> KEY `index_uid` (`uid`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学员关系表';
Query OK, 0 rows affected (0.15 sec) mysql> set sql_log_bin=1;
Query OK, 0 rows affected (0.00 sec) # 然后在主库中创建这个表
mysql> CREATE TABLE `fudao_student_lable` (
-> `id` int(11) NOT NULL AUTO_INCREMENT,
-> `uid` int(11) unsigned NOT NULL COMMENT '学员id',
-> `tid` int(11) unsigned NOT NULL DEFAULT '' COMMENT '老师id',
-> PRIMARY KEY (`id`),
-> KEY `index_tid` (`tid`),
-> KEY `index_uid` (`uid`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学员关系表';
Query OK, 0 rows affected (0.13 sec) # 在从库中出现同步异常
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.10.50.60
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000021
Read_Master_Log_Pos: 2220
Relay_Log_File: relay-bin.000051
Relay_Log_Pos: 1971
Relay_Master_Log_File: mysql-bin.000021
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1050
Last_Error: Error 'Table 'fudao_student_lable' already exists' on query. Default database: 'test'. Query: 'CREATE TABLE `fudao_student_lable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) unsigned NOT NULL COMMENT '学员id',
`tid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '老师id',
PRIMARY KEY (`id`),
KEY `index_tid` (`tid`),
KEY `index_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学员关系表''
Skip_Counter: 0
Exec_Master_Log_Pos: 1761
Relay_Log_Space: 90227909
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: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1050
Last_SQL_Error: Error 'Table 'fudao_student_lable' already exists' on query. Default database: 'test'. Query: 'CREATE TABLE `fudao_student_lable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) unsigned NOT NULL COMMENT '学员id',
`tid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '老师id',
PRIMARY KEY (`id`),
KEY `index_tid` (`tid`),
KEY `index_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学员关系表''
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1574144089
Master_UUID: 0501f340-0a94-11ea-ad2b-5254007dcbb3
Master_Info_File: mysql.slave_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: 191204 17:03:40
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 0501f340-0a94-11ea-ad2b-5254007dcbb3:10-5440871
Executed_Gtid_Set: 0501f340-0a94-11ea-ad2b-5254007dcbb3:1-5440870,
137347eb-0a94-11ea-ad2b-525400dd43f8:1-531071
Auto_Position: 0
1 row in set (0.01 sec) ERROR:
No query specified mysql> # 处理方法:以主库为准
# 在从库中执行:
set sql_log_bin=0;
drop table fudao_student_lable;
set sql_log_bin=1;
start slave sql_thread;
show slave status\G; mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.10.50.60
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000021
Read_Master_Log_Pos: 2220
Relay_Log_File: relay-bin.000051
Relay_Log_Pos: 2430
Relay_Master_Log_File: mysql-bin.000021
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
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: 2220
Relay_Log_Space: 90227909
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:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1574144089
Master_UUID: 0501f340-0a94-11ea-ad2b-5254007dcbb3
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 0501f340-0a94-11ea-ad2b-5254007dcbb3:10-5440871
Executed_Gtid_Set: 0501f340-0a94-11ea-ad2b-5254007dcbb3:1-5440871,
137347eb-0a94-11ea-ad2b-525400dd43f8:1-531071
Auto_Position: 0
1 row in set (0.00 sec) ERROR:
No query specified mysql> # 同步正常 [root@dba_test_002 ~]#

gtid 同步1050异常处理的更多相关文章

  1. gtid同步异常处理

    gtid同步异常处理 分析出现问题时候GTID值 通过分析法获取gtid值 通过查看mysql> show slave status \G;查看一下信息并记录下来:Retrieved_Gtid_ ...

  2. LVS+MYCAT读写分离+MYSQL同步部署手册(第三版)

    1      配置MYSQL主备同步 1.1    测试环境 mysql版本:5.6.24: 操作系统内核版本:Linux-3.13-0-32 主数据库IP:192.168.10.3: 主数据库名:d ...

  3. mysql之 mysql 5.6不停机主从搭建(一主一从基于GTID复制)

    环境说明:版本 version 5.6.25-log 主库ip: 10.219.24.25从库ip:10.219.24.22os 版本: centos 6.7已安装热备软件:xtrabackup 防火 ...

  4. GTID复制详解

    前言 GTID复制是MySQL 5.6后的新功能,在传统的方式里,主从切换后,需要找到binlog和POS点,然后执行命令change master to 指向新的主库.对于不是很有经验的人来说,往往 ...

  5. MYSQL5.7实时同步数据到TiDB

    操作系统:CentOS7 mysql版本:5.7 TiDB版本:2.0.0 同步方法:使用TiDB提供的工具集进行同步 说明: 单机mysql同步时,可以直接使用binlog同步, 但mysql集群进 ...

  6. mysql gtid 第一篇

    GTID1 简介   就是全局事务ID(global transaction identifier )2 构成   uuid+transaction_id 3 格式  7a07cd08-ac1b-11 ...

  7. MySQl新特性 GTID

    GTID简介 概念 全局事务标识符(GTID)是创建的唯一标识符,并与在源(主)服务器上提交的每个事务相关联.此标识符不但是唯一的,而且在给定复制设置中的所有服务器上都是唯一的.所有交易和所有GTID ...

  8. 使用GTID给Galera集群做数据库异步复制

    一.为什么要做Galera集群异步复制 Galera集群解决了数据库高可用的问题,但是存在局限性,例如耗时的事务处理可能会导致集群性能急剧下降,甚至出现阻塞现象.而不幸的是,类似报表等业务需求就需要做 ...

  9. mysql-5.7 调整mysql的复制方式由master_log_file+master_log_pos 到gtid 详解

    一.祖传的master_log_file + master_log_pos的复制方式面临的问题: 在很久以前 那个时候我还没有出道,mysql就已经就有复制这个功能了.如果要告诉slave库从mast ...

随机推荐

  1. vue 事件中的 .native

    vue组件添加事件@click.native native是什么? .native - 监听组件根元素的原生事件. 主要是给自定义的组件添加原生事件. 官网的解释: 你可能想在某个组件的根元素上监听一 ...

  2. length 和 size 区分

    ​ 总是混淆length和size,今天专门区分一下 1.在java代码(.java)中 1.length属性是针对Java中的数组来说的,要求数组的长度可以用其length属性: 2.length( ...

  3. Codeforces 1244D. Paint the Tree

    传送门 首先如果某个点的度数大于 $2$ 那么显然无解 然后考虑点的度数小于等于 $2$ 的情况 发现其实是一条链 一旦确定了链开头的两个点,后面的点的颜色都可以通过之前的点推出 所以直接枚举即可 # ...

  4. Lua的API函数

    1. 基础库 我们在整个教程中使用了各种主题下的基本库. 下表提供了相关页面的链接,并列出了本Lua教程各部分所涵盖的功能. 编号 库/方法 作用 1 错误处理 包括错误处理函数,如断言, 错误,如L ...

  5. 26-Perl 包和模块

    1.Perl 包和模块Perl 中每个包有一个单独的符号表,定义语法为:package mypack;此语句定义一个名为 mypack 的包,在此后定义的所有变量和子程序的名字都存贮在该包关联的符号表 ...

  6. js变量浅拷贝 深拷贝

    js的变量分为简单数据类型和复杂数据类型(即引用类型). 简单数据类型在内存中占据着固定大小的空间,被保存在栈内存中,在简单数据类型中,当一个变量指向另一个变量时,只是创建了值的副本,两个变量只是占用 ...

  7. Java 代码运行顺序

    1.静态代码块,只执行一次,从上到下,先父类后子类 2.父类构造代码块,从上到下,然后父类构造方法,执行次数与实例化次数相关 3.子类构造代码块,从上到下,然后子类构造方法,执行次数与实例化次数相关

  8. python操作MySQL数据库(转)

    先来一个简单的例子吧: ? 1 2 3 4 5 6 7 8 9 10 import MySQLdb   try:     conn=MySQLdb.connect(host='localhost',u ...

  9. O043、计算节点宕机了怎么办

    参考https://www.cnblogs.com/CloudMan6/p/5562131.html   Rebuild 可以恢复损坏的instance .那如果是宿主机坏了怎么办呢?比如硬件故障或者 ...

  10. 4.ID主键生成策略

    保证唯一性(auto_increment) 一.xml方式 <?xml version="1.0"?> <!DOCTYPE hibernate-mapping P ...