Roll Back to Traditional Replication From GTID

If you want to roll back to old :

# Now, we are going to turn GTID’s off

Slave 192.168.66.7

mysql> set global gtid_mode='on_permissive';
Query OK, 0 rows affected (0.02 sec)

 

Master 192.168.66.5

mysql> set global gtid_mode='on_permissive';
Query OK, 0 rows affected (0.02 sec)

 

Slave 192.168.66.7

mysql> set global gtid_mode='off_permissive';
Query OK, 0 rows affected (0.01 sec)

Master 192.168.66.5

mysql> set global gtid_mode='off_permissive';
Query OK, 0 rows affected (0.01 sec)

At this point, the replication will break at slave side. we will stop the salve and change master position and logfile mention as below error shown from slave status.

Slave 192.168.66.7

mysql> show slave status\G
*************************** 1. row ***************************
Last_IO_Errno: 13114
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 
'Cannot replicate anonymous transaction when AUTO_POSITION = 1, at file ./mysql-bin.000007, 
position 196.; the first event '' at 4, the last event read from './mysql-bin.000007' at 275, 
the last byte read from './mysql-bin.000007' at 275.'

mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
mysql> change master to master_log_file='mysql-bin.000007',
master_log_pos=196,master_auto_position=0;
Query OK, 0 rows affected (0.02 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

Now check the slave status replication will work fine, but we will still need to stop the GTID’s.

 

mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.66.5
Master_User: syncstndby
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000007
Read_Master_Log_Pos: 1070076
Relay_Log_File: serverB-relay-bin.000002
Relay_Log_Pos: 1070204
Relay_Master_Log_File: mysql-bin.000007
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
.
.
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 1070076
Relay_Log_Space: 1070415
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
.
.
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: 95358015-b479-11ea-ab4c-080027267f61
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
.
.
Executed_Gtid_Set: 95358015-b479-11ea-ab4c-080027267f61:1-10110
.
.
Network_Namespace:
1 row in set (0.00 sec)

mysql> select @@global.gtid_owned;
+---------------------+
| @@global.gtid_owned |
+---------------------+
|                     |
+---------------------+
1 row in set (0.00 sec)

Master 192.168.66.5

mysql> select @@global.gtid_owned;
+---------------------+
| @@global.gtid_owned |
+---------------------+
|                     |
+---------------------+
1 row in set (0.00 sec)

Now we will turn off the gtid-mode =off

Slave 192.168.66.7

mysql> set global gtid_mode=off;
Query OK, 0 rows affected (0.01 sec)

Master 192.168.66.5

mysql> set global gtid_mode=off;
Query OK, 0 rows affected (0.01 sec)

 

This will stop Changing the GTID after you move back

Executed_Gtid_Set: 95358015-b479-11ea-ab4c-080027267f61:1-10110

But Exec_Master_Log_Pos: 181924 Relay_Log_Space: 182357 will keep changing, this output can be observed in show slave status.

 634 views last month,  4 views today

About Mughees Ahmed

Over 2-year experience of Administration in Oracle, SQL Server, and MySQL databases using various tools and technologies. Keen on learning new database technologies having very good analytical skills. Working knowledge of Red Hat Linux, UNIX, Solaris and Windows Server 2012 is a valuable addition to my knowledge desk. KNOWLEDGE & SKILLS • Oracle Database Server 10g/11g/12c. • Oracle RAC, Data guard. • Oracle Golden Gate (Oracle to Oracle, Oracle to MySQL and MySQL to Oracle) • Oracle Enterprise Manager Grid Control, Toad, SQL developer. • SQL Server 2005/2008/2012/2016. • SQL Server Failover clustering, mirroring & log shipping, Always On availability groups. • MySQL 5 Administration, MySQL Workbench, MySQL Enterprise Monitor, SQLyog • MySQL NDB Cluster Installation,Administration. • MySQL Asynchronous/Semi-synchronous replication. • Oracle OEM Contact me on mughees52@gmail.com

Check Also

blank

Migrate from traditional replication to GTID

In this article, we are going to take a look at migrating from traditional replication …

Leave a Reply