Home  >  Article  >  Database  >  MySQL - Detailed explanation of the method of switching Master server or relay server in GTIDs Replication mode

MySQL - Detailed explanation of the method of switching Master server or relay server in GTIDs Replication mode

黄舟
黄舟Original
2017-03-13 16:42:241505browse

GTIDs Replication can arbitrarily designate a serviceserver as the relay Slave server or Master server of another server.

For example, if there are three MySQL servers A, B, and C, A is the Master server of B and C. Currently, B is to be turned into a relay server for C. The specific operation method is as follows:

1. Execute the following commands on server B

mysql>  GRANT REPLICATION SLAVE ON *.* TO 'lyz'@'C的ip地址' IDENTIFIED BY 'lyz';

2. Execute the following operations on server C in sequence

(1) Stop slave
mysql> stop slave;
(2)Configure slave
mysql> change master to
	-> master_host='B的ip地址',
	-> master_port=3306,
	-> master_user='lyz',
	-> master_password='lyz',
	-> master_auto_position=1;
(3)Start slave
mysql > start slave;

The above is the detailed content of MySQL - Detailed explanation of the method of switching Master server or relay server in GTIDs Replication mode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn