Hello
I’m trying to set up multi-source replica, so one server will have 2 databases, each database will be replica from another remote server.
I set up first channel fine but I’m having issues setting up second one.
I can see the issue is that I need to tell second channel what his GTID is but I don’t understand how can I do that without breaking first channel as well.
According to this link
https://dev.mysql.com/doc/mysql-replication-excerpt/8.0/en/replication-multi-source-provision-replica.html
only way to repair is rebuild both from start?
Is there a way I can do this
mysql> RESET MASTER;
mysql> SET @@GLOBAL.gtid_purged = "2174B383-5441-11E8-B90A-C80AA9429562:1-1029, 224DA167-0C0C-11E8-8442-00059A3C7B00:1-2695";
But just for 1 channel , if the other one is working fine.
Thank you
You need to set gtid_purged to the GTID of both sources, then setting up the separate channels should work just fine.
What error are you getting on the second channel?
Well one channel was working already for some time so I tried setting up second one.
How can i set up GTID purged for both in that instance?
I mean I know GTID for second one, the one im trying to build but what to put for first one, the one that is working for some time.
Stop replication for all channels. Set gtid_purged to be the CONCAT($gtid1, ‘,’, $gtid2) (just put them together). You don’t set gtid_purged for individual channels; you do this globally for all channels. Then start channel 1, start channel 2. When you run show replica status for channel 1, and for channel 2, you’ll see the entire GTID set.
Well how can I get GTID purged from working channel aka first one.
I always got GTID purged via backup, either xtradbackup or mysqldump on master server and restore those backups on slaves.
Is there easier way to get gtid purged I was unaware, the one where i don’t need to make a backup and restore it?
If replica #2 has a completely different dataset, then you must take a logical backup (mysqldump or mydumper) of replica #2 and restore that to the multi-source server (otherwise you have no starting point for channel #2). When you do this, you’ll get the GTID of replica #2. Concat that with GTID from replica #1 and that becomes your gtid_purged.
Yes, i understand that part. My question is how to get GTID purged from channel 1, the one I’m not restoring from backup.
STOP REPLICA FOR CHANNEL 1; SHOW REPLICA STATUS;
use Executed_GTID as the purged for channel 1.
1 Like