Build your own command-line replica with GTID aware mariadb binlog

Click for: original source

This blog post begins a three part series to create and customize your own asynchronous MariaDB replication client. With the release of MariaDB Community Server 10.8.1, the mariadb-binlog command line utility now supports both 1) filtering events by GTID ranges, and 2) validating a binary log’s ordering of Global Transaction IDentifiers (GTIDs). By Brandon Nesterenko.

A large amount has been written that highlights the value of MariaDB’s Global Transaction IDentifiers (GTID), but to quickly summarize a few main ideas:

  • Using GTIDs to represent replication state allows for explicit crash safety and easy server topology changes.
  • Replay consistency can be validated by ensuring that sequence numbers are monotonically increasing within a given domain.
  • Event execution can be parallelized at the domain-level, as independent data streams can be tagged with different domain ids.

The article then goes over and explains:

  • Background on GTIDs
  • The design of components for command-line client
  • The replication client implementation

This blog post provided an overview on using GTIDs to maintain replication state for consistent event replay, as well as the workflow of replication on a mariadbd instance. We then used this information to build our own command-line replica using the mariadb-binlog and mariadb executables. Interesting read!

[Read More]

Tags app-development mysql database performance