Get the App
SLTechnology News&Howtos  ›  Database  › 

Master-Slave Construction based on GTID

Shulou Source: shulou.com Published: 2022-06-01 07:31:09 09月28日 Update

Note: what is built here is one master and multiple slaves.

Environment: centos7+MySQL5.7

Master: 192.168.162.134

From 1RV 192.168.162.133

From 2RV 192.168.162.135

Installation reference: http://liyingdi.blog.51cto.com/6397405/1879993

Master server configuration:

Server_id = 134# guarantee unique

Log-bin = mysql-bin # Open binlog

Gtid-mode = on # turn on gtid mode

Enforce-gtid-consistency=1 # enforces gtid consistency

two。 Restart the primary server and create a replication user.

Grant replication slave on *. * to 'rpl133'@'192.168.162.133' identified by' 123456'

Grant replication slave on *. * to 'rpl133'@'192.168.162.135' identified by' 123456'

3. Configure two slave servers

Server_id = 133If it's a 135server, it's 135,

Log-bin = mysql-bin

Whether log-slave-updates=true # slave updates are logged

Gtid-mode=on

Enforce-gtid-consistency=true

4 define the link to the master library on the slave library

Change master to master_host='192.168.162.134',master_user='rpl133',master_password='123456',MASTER_AUTO_POSITION=1

5. Start slave

6. test

PS: the building here is the most basic master and slave, and individuals can optimize various parameters according to their own production links.

Tags: Server service configuration master-slave consistency two individual parameter foundation comment log mode environment link user link guarantee force update Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MySQL OPPO Reno Redmi Shulou Information