Disabling GTID-based replication for a MySQL DB instance with read replicas
You can disable GTID-based replication for a MySQL DB instance with read replicas.
To disable GTID-based replication for a MySQL DB instance with read replicas
-
On each read replica, run the following procedure:
MySQL 8.4 and higher major versions
CALL mysql.rds_set_source_auto_position(0);
MySQL 8.0 and lower major versions
CALL mysql.rds_set_master_auto_position(0);
-
Reset the
gtid_mode
toON_PERMISSIVE
.-
Make sure that the parameter group associated with the MySQL DB instance and each read replica has
gtid_mode
set toON_PERMISSIVE
.For more information about setting configuration parameters using parameter groups, see Parameter groups for Amazon RDS.
-
Reboot the MySQL DB instance and each read replica. For more information about rebooting, see Rebooting a DB instance.
-
-
Reset the
gtid_mode
toOFF_PERMISSIVE
.-
Make sure that the parameter group associated with the MySQL DB instance and each read replica has
gtid_mode
set toOFF_PERMISSIVE
. -
Reboot the MySQL DB instance and each read replica.
-
-
Wait for all of the GTID transactions to be applied on all of the read replicas. To check that these are applied, do the following steps:
-
On the MySQL DB instance, run the following command:
MySQL 8.4
SHOW BINARY LOG STATUS
MySQL 5.7 and 8.0
SHOW MASTER STATUS
Your output should be similar to the following output.
File Position ------------------------------------ mysql-bin-changelog.000031 107 ------------------------------------
Note the file and position in your output.
-
On each read replica, use the file and position information from its source instance in the previous step to run the following query:
MySQL 8.4 and MySQL 8.0.26 and higher MySQL 8.0 versions
SELECT SOURCE_POS_WAIT('
file
',position
);MySQL 5.7
SELECT MASTER_POS_WAIT('
file
',position
);For example, if the file name is
mysql-bin-changelog.000031
and the position is107
, run the following statement:MySQL 8.4 and MySQL 8.0.26 and higher MySQL 8.0 versions
SELECT SOURCE_POS_WAIT('mysql-bin-changelog.000031', 107);
MySQL 5.7
SELECT MASTER_POS_WAIT('mysql-bin-changelog.000031', 107);
-
-
Reset the GTID parameters to disable GTID-based replication.
-
Make sure that the parameter group associated with the MySQL DB instance and each read replica has the following parameter settings:
-
gtid_mode
–OFF
-
enforce_gtid_consistency
–OFF
-
-
Reboot the MySQL DB instance and each read replica.
-