Charles Dirk <charlesdirk7@gmail.com> writes:
Concerning this project, my first thoughts are: we connect to each slave using the perl DBI package and get the latest GTID transaction applied at that slave, parse each GTID from each slave, and for each domain-id part of the GTID, we return the IP of the slave whose sequence number is highest and that way we have our new Master to take over.
This would work in many cases. You might want to consider also the approach described in this link, which handles correctly the case where different slaves are ahead in different domains, and the case where gtid_strict_mode=0 and sequence numbers can be out-of-order: https://mariadb.com/kb/en/mariadb/gtid/#start-slave-until-master_gtid_posxxx - Kristian.