zoukankan      html  css  js  c++  java
  • 传统复制的复制结构之间转换

    今天来写一个传统复制的复制结构之间的转换问题。

    a-->b
    a-->c
    转换成a-->b-->c
    a:create table i_hgr(id int);
    此时b和c上都有了表 i_hgr
    先在b和c删除表i_hgr --> b,c:drop table i_hgr;
    a:drop table i_hgr;
    此时复制出错,而b和c停在一个位置上
    在b上获取position位置,在c上change master to ... master_log_file='show b.master status.log_file', 
    master_log_pos='show b.master status.log_pos'
    c:start slave;
    这时完成 了b-->c 复制

    接下来修复a-->b复制
    b;create table i_hgr(id int);
    b:start sql_thread;
    完成a-->b-->c复制结构。

    如果想把a-->b--c 再还原回a--b,a--c的复制结构
    b:stop slave;
    此时b和c同步的位置一样
    注:判断c和b是否一样,去b 上show master status;
    b.show master status.file=c.master_log_file
    b.show master status.position=c.read_master_log_pos
    另外:
    假如b:show master status;
    master_log_file,read_master_log_pos与relay_master_log_file,exec_master_log_pos不相等时,那要取哪个呢?
    答案是用relay_master_log_file和exec_master_log_pos
    原因是要选执行到的位置,即sql_thread
    接下来在c 上 change master to .... master_log_file='xxx',master_log_pos=xxx;
    c;start slave;
    b上直接start slave
    b;start slave;
    完成了a-->b,a-->c的复制 结构。

  • 相关阅读:
    Queries about less or equal elements CodeForces
    Session in BSU CodeForces
    基环树
    骑士 HYSBZ
    Valid BFS? CodeForces
    Trips CodeForces
    The writing on the wall 南京网络赛2018B题
    Building a Space Station
    Constructing Roads
    Networking
  • 原文地址:https://www.cnblogs.com/hmysql/p/8998142.html
Copyright © 2011-2022 走看看