
The relay_log_info_file system variable can be set either on the command-line
or in a server option group in an option file prior to starting up the server.
For example:

[mariadb]
...
relay_log_info_file=/mariadb/myserver1-relay-log.info

GTID Persistence
----------------

If the replica is replicating binary log events that contain GTIDs, then the
replica's SQL thread will write every GTID that it applies to the
mysql.gtid_slave_pos table. This GTID can be inspected and modified through
the gtid_slave_pos system variable.

If the replica has the log_slave_updates system variable enabled and if the
replica has the binary log enabled, then every write by the replica's SQL
thread will also go into the replica's binary log. This means that GTIDs of
replicated transactions would be reflected in the value of the gtid_binlog_pos
system variable.

Creating a Replica from a Backup
--------------------------------

The CHANGE MASTER statement is useful for setting up a replica when you have a
backup of the primary and you also have the binary log position or GTID
position corresponding to the backup.

After restoring the backup on the replica, you could execute something like
this to use the binary log position:

CHANGE MASTER TO
 MASTER_LOG_FILE='master2-bin.001',
 MASTER_LOG_POS=4;
START SLAVE;

Or you could execute something like this to use the GTID position:

SET GLOBAL gtid_slave_pos='0-1-153';
CHANGE MASTER TO
 MASTER_USE_GTID=slave_pos;
START SLAVE;

See Setting up a Replication Slave with Mariabackup for more information on
how to do this with Mariabackup.

Example
-------

The following example changes the primary and primary's binary log
coordinates. This is used when you want to set up the replica to replicate the
primary:

CHANGE MASTER TO
 MASTER_HOST='master2.mycompany.com',
 MASTER_USER='replication',
 MASTER_PASSWORD='bigs3cret',
 MASTER_PORT=3306,
 MASTER_LOG_FILE='master2-bin.001',
 MASTER_LOG_POS=4,
 MASTER_CONNECT_RETRY=10;
START SLAVE;

URL: https://mariadb.com/kb/en/change-master-to/