In what circumstances would you use a different value for gtid_domain_id and server_id in mariadb GTID replication?
0
votes
1
answer
265
views
I'm learning about MariaDB GTID replication and one thing I am completely stuck on is why GTIDs have both a domain ID and a server ID, which make up the (domain_id)-(server_id)-(sequence_number) in the GTID, such as 0-1-12345.
The docs are very thorough, but don't address this question directly.
I've learned as a result of this wonderful video that the sequence number increments for each transaction, but *is tied to the domain_id*. This doesn't seem to be stated anywhere in the GTID docs.
So, if you have two servers with server_id 1 and 2, but the same domain_id (say, 1), the GTIDs would indeed be delineated due to the unique server_id, but they would share the same sequence number.
e.g. Alternating transactions on server 1 followed by server 2 would result in the following:
1-1-1
1-2-2
1-1-3
1-2-4
They're still unique, so I have to figure they work just fine for replication. I'd love to be corrected if that is wrong though.
Anyway, if you set the domain IDs to 1 and 2, this would be the result:
1-1-1
2-2-1
1-1-2
2-2-2
But it is still not clear to me *why* or *how* you'd want to have a unique sequence per server.
If two master servers had the same server ID and domain ID, then there would be a conflict. But the question is why would you ever want to have two servers with the same server ID, such that you need to have a unique domain id per server?
Or perhaps there is there a tool and use-case for extracting a specific domain stream out of the shared binlog, which perhaps can't be done just by specifying the server_id?
Asked by nickchomey
(109 rep)
Jul 27, 2024, 01:41 AM
Last activity: Aug 9, 2024, 11:37 AM
Last activity: Aug 9, 2024, 11:37 AM