zoukankan      html  css  js  c++  java
  • gtid error set test

    1、从库报主键重复(Errno: 1062)
    #create test data 1062
    create table t1 (id tinyint not null primary key,ename varchar(20),blog varchar(50));
    insert into t1 values(1,'leshami','http://blog.csdn.net/leshami');
    insert into t1 values(2,'robin','http://blog.csdn.net/robinson_0612');
    set sql_log_bin=off;
    delete from t1 where ename='robin';
    set sql_log_bin=on;
    insert into t1 values(2,'robin','http://blog.csdn.net/robinson_0612');

    #set
    stop slave;
    delete from t1 where ename='robin';
    start slave;
    show slave status G

    ====================
    2、从库报找不到对应的被更新的记录(Errno: 1032)
    #slave
    delete from t1 where ename='leshami';
    #master
    update t1 set blog='http://blog.csdn.net/robinson_0612' where ename='leshami';
    #slave
    show slave status G
    ---set slave
    stop slave sql_thread;
    insert into t1 values(1,'leshami','http://blog.csdn.net/leshami');
    start slave sql_thread;
    show slave status G

    3、从库找不到对应的被删除的记录(Errno: 1032)
    #slave
    delete from t1 where ename='robin';
    #master
    delete from t1 where ename='robin';
    #slave
    show slave status G
    --set slave
    stop slave sql_thread;
    set gtid_next='6ad6c92a-13c2-11e7-8929-000c29511923:38';
    begin;commit;
    set gtid_next='AUTOMATIC';
    start slave sql_thread;
    show slave status G

    4、延迟从修复主库意外truncate
    #master
    create table t2 (id tinyint not null primary key, ename varchar(20),blog varchar(50));
    insert into t2 values(1,'leshami','http://blog.csdn.net/leshami');
    insert into t2 values(2,'robin','http://blog.csdn.net/robinson_0612');
    select * from t2;

    #slave
    stop slave sql_thread;
    CHANGE MASTER TO MASTER_DELAY = 300;
    start slave sql_thread;
    show slave status G

    #master
    show master statusG
    truncate table t2;
    show master statusG

    #slave
    stop slave sql_thread;
    set gtid_next='6ad6c92a-13c2-11e7-8929-000c29511923:44';
    begin;commit;
    set gtid_next='AUTOMATIC';
    start slave sql_thread;
    show slave status G

    5、主库binlog被purge的情形(Errno: 1236)

    get error gtid

    ----

    #!/usr/bin/python
    import re

    gtid = "this iekdkdk '6ad6c92a-13c2-11e7-8929-000c29511923:534878' edkdke iekdk iekdk k"
    grs= "[0-9,a-z]{8}-[0-9,a-z]{4}-[0-9,a-z]{4}-[0-9,a-z]{4}-[0-9,a-z]{12}:d+"
    rev = re.findall(grs,gtid)
    print(rev[0])
  • 相关阅读:
    Idea默认的全局设置,如Maven等
    mybatis中Parameter index out of range (1 > number of parameters, which is 0).
    SpringBoot入门-2(两种热部署方式)
    Java中关于static语句块的理解
    HashMap源码剖析
    keytool用法总结
    Tomcat配置https
    git的安装及其使用
    java中Arrays类的应用
    三次握手四次挥手
  • 原文地址:https://www.cnblogs.com/moss_tan_jun/p/7881796.html
Copyright © 2011-2022 走看看