0% found this document useful (0 votes)
44 views1 page

Setting Up GTID Replication

This document outlines the steps to configure GTID replication in MySQL, starting with stopping the MySQL service and modifying configuration files. It includes instructions for taking a backup, setting the instance to read-only mode, restoring the backup on the slave, and verifying the replication setup. The process concludes with commands to check the slave status and verify GTID replication functionality.

Uploaded by

ljana6601
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views1 page

Setting Up GTID Replication

This document outlines the steps to configure GTID replication in MySQL, starting with stopping the MySQL service and modifying configuration files. It includes instructions for taking a backup, setting the instance to read-only mode, restoring the backup on the slave, and verifying the replication setup. The process concludes with commands to check the slave status and verify GTID replication functionality.

Uploaded by

ljana6601
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

### Configuring GTID Replication

Step 1. Stop MySQL Service


$ sudo systemctl stop mysqld.service

Step 2. Add following lines in master.cnf & slave.cnf


$ sudo vim /etc/my.cnf.d/master.cnf

# GTID Replication Setup


gtid_mode = ON
enforce_gtid_consistency = 1

Step 3. Start MySQL on master and then slave


$ sudo systemctl start mysqld.service

Step 4. Put the instance in read-only mode


mysql> set global read_only=true;

Step 5. Take Backup


$ sudo mysqldump --all-databases --single-transaction --triggers --routines --
events --user=root --password > backup.sql

Step 6. Take off Read Only mode


mysql> set global read_only= OFF

Step 7. Restore backup on slave


# mysql -u root -p < backup.sql

Step 8. Change master


mysql> CHANGE MASTER TO MASTER_HOST='master1', MASTER_USER='repl_user',
MASTER_PASSWORD='P@ssw0rd', MASTER_AUTO_POSITION=1;

Step 9. Start slave and check status


mysql> start slave;
mysql> show slave status\G

Step 10. Verify GTID Replication


mysql> show global variables like '%gtid_%';
mysql> select * from mysql.gtid_executed;

You might also like