Converting between replication structures of traditional replication

Today, let's write a conversion problem between traditional replication and replication structures.

a-->b
a-->c
is converted to a-->b-->c
a:create table i_hgr(id int);
At this time, there are tables i_hgr on both b and c.
First delete the table i_hgr in b and c --> b,c:drop table i_hgr;
a:drop table i_hgr;
At this time, there is an error in copying, and b and c stop at one position
, get the position position on b, and change master to ... master_log_file=' on c show b.master status.log_file', \
master_log_pos='show b.master status.log_pos'
c:start slave; at
this time, b-->c replication is completed,
then repair a-->b replication
b; create table i_hgr (id int);
b:start sql_thread;
complete a-->b-->c copy structure.

If you want to restore a-->b--c back to a--b, a--c replication structure
b: stop slave;
at this time b and c are synchronized at the same position
Note: To judge whether c and b are the same, go to b show master status;
b.show master status.file=c.master_log_file
b.show master status.position=c.read_master_log_pos
In addition:
if b:show master status;
master_log_file, read_master_log_pos and relay_master_log_file, exec_master_log_pos are not equal, then Which one to take?
The answer is to use relay_master_log_file and exec_master_log_pos
because the reason is to choose the location to be executed, that is, sql_thread
will change master to .... master_log_file='xxx', master_log_pos=xxx;
c; start slave;
directly start slave b on
b ;start slave;
Complete the replication structure of a-->b,a-->c.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325472675&siteId=291194637