Slave_IO_Running: No
Slave_SQL_Running: Yes
Last_IO_Errno: 1236
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary lo
gs containing GTIDs that the slave requires. Replicate the missing transactions from elsewhere, or provision a new slave from backup. Consider increasing the master's binary log expiration period.
The way to solve this is outlines below
On Master
--------------
Take a mysqldump from the master and then copy it to the slave. Say your dump file is mysqldump_db-01_2020-05-13.sql.gz
Take a mysqldump from the master and then copy it to the slave. Say your dump file is mysqldump_db-01_2020-05-13.sql.gz
On Slave
-------------
[sudeep@db-slave ~]$ gunzip mysqldump_db-01_2020-05-13.sql.gzRecord the gtid_purged value that mysqldump added to the dump file.
[sudeep@db-slave~]$ cat mysqldump_db-01_$(date +%F).sql | grep GTID_PURGED | cut -f2 -d'=' | cut -f2 -d$'\''
a21bbd99-935e-11ea-a7c0-080027677b11:1-100
Remove the line from the dump file that contains the SET @@GLOBAL.gtid_purged statement
[sudeep@db-slave~]$ sed '/GTID_PURGED/d' mysqldump_db-01_$(date +%F).sql > mysqldump_db-01_gtid_nopurge_$(date +%F).sql
[sudeep@db-slave~]$sudo mysql -e "source mysqldump_db-01_gtid_nopurge_$(date +%F).sql"
[sudeep@db-slave ~]$ sudo mysql -e "RESET MASTER"
The reset master command should clear the GTID_EXECUTED on slave
[sudeep@db-slave ~]$ sudo mysql -e "show global variables like '%GTID_EXECUTED%'"
+---------------+----------+
| Variable_name | Value |
+---------------+----------+
| gtid_executed | |
+---------------+----------+
[sudeep@db-slave ~]$ sudo mysql -e "START SLAVE io_thread"
[sudeep@db-slave ~]$ sudo mysql -e "SHOW SLAVE STATUS\G" | grep -i yes
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
No comments:
Post a Comment