Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Cascade replication is transformed into one master and two slaves

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. As shown in the figure, if cascade replication is converted into one master and two slaves?

GTID copy processing method:

Just stop copying S2 and change it to M again.

S2:

stop slave;

reset slave all;

change master to M;

start slave

Traditional copy processing methods (more complex):

(1) Stop copying S1, at which point S1 and S2 stop at the same location.

(2) Perform show slave status on S1\G

root@localhost [testdb]>show slave status\G

*************************** 1. row ***************************

Slave_IO_State:

Master_Host: 192.168.91.22

Master_User: repl

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000008

Read_Master_Log_Pos: 917

Relay_Log_File: relay-bin.000011

Relay_Log_Pos: 718

Relay_Master_Log_File: mysql-bin.000008

Slave_IO_Running: No

Slave_SQL_Running: No

Exec_Master_Log_Pos: 917

(3) Change S2 to the main library M

change master to

master_host='192.168.91.22',

master_port=3306,

master_user='repl',

master_password='147258',

master_log_file='mysql-bin.000008 ',

master_log_pos='917 ';

(4) Finally, start S1 replication

2. As shown in the figure, how can one master and two slaves be converted into cascade replication?

GTID copy processing method:

Simple, direct S2change to the main library S1

Traditional copy processing methods:

(1) Make both S1 and S2 copy error at a certain point, such as 1032 error, so that both copies stop at the same position, determine the master_log_file and master_log_pos positions

(2) Change S2 to S1

(3) Fix S1 error

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 280

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report