Switchover MySQL
Β
Source 199
Replica 198
SOURCE
SET GLOBAL read_only=ON;
set global super_read_only=ON;
show variables like '%super%read%';
show variables like '%read_only%';
flush tables;
flush logs;
SHOW MASTER STATUS;
REPLICA
stop slave;
set global read_only=OFF;
set global super_read_only=OFF;
show variables like '%read_o%';
SHOW MASTER STATUS; -- TEST-SQL2-bin.000002 --2760785
create user 'rep_user'@'172.25.2.198' identified with mysql_native_password by 'CP@MySQL2023';
create user 'repcat'@'%' identified by 'CP@MySQL2023';
grant replication client, replication slave on *.* to 'repcat'@'%';
grant replication client, replication slave on *.* to 'rep_user'@'172.25.2.198';
rename user 'rep_user'@'172.25.2.198' to 'rep_user'@'%';
Flush privileges;
select * from mysql.user;
drop user 'rep_user'@'172.25.2.199';
drop user 'rep_user'@'%';
Source —> which is new Replica
change master to master_host=’172.25.2.198′ , master_user=’repcat’,master_password=’CP@MySQL2023′,master_log_file=’TEST-SQL1-bin.000001′,master_log_pos=5380 ;
Β