Multi source replication

You are viewing an old version of this article. View the current version here.

Multi source replication means that one server has many masters from which it replicates. This is a new feature in the upcoming MariaDB 10.0 release.

New Syntax

You specify which master connection you want to work with by either specifying the connection name in the command or setting @@default_master_connection to the connection you want to work with.

The connection name may include any characters and should be less than 64 characters. You should preferably keep this short as it will be used as a suffix for relay logs and master info index files.

The new syntax introduced to handle many connections are:

The original old-style connection is an empty string ''. You don't have to use this connection if you don't want to.

You create new master connections with CHANGE MASTER.

Replication variables for multi source

The new replication variable @@default_master_connection specifies which connection will be used for commands and variables if you don't specify a connection. By default this is '' (the default connection name).

The following replication variables are local for the connection. (In other words, they show the value for the @@default_master_connection connection). We are working on making all the important ones local for the connection.

TypeNameDescription
StatusSlave_runningShows if the slave is running

Example:

set @@default_master_connection='';
show status like 'Slave_running';
set @@default_master_connection='other_connection';
show status like 'Slave_running';

If @@default_master_connection contains a non existing name, you will get a warning.

All other master related variables are global and affect all connections.

New files

The basic principle of the new files used by multi source replication is that they have the same name as the original relay log files suffixed with connection_name. The main exception is the file that holds all connection that is named as the normal master-info-file with a .index suffix.

When you are using multi source, the following new files are created:

NameDescription
master-info-filename.indexThe master_info file (normally master.info) with a .index suffix. This contains all master connections in use.
relay-log-connection_name.xxxxxThe relay-log name with a connection_name suffix. The xxxxx is the relay log number. This contains the replication data read from the master.
relay-log-index-connection_name  Contains the name of the active relay-log#-connection_name.xxxxx files.
relay-log-info.connection_nameContains the current master position for the connection.

Limitations

  • You can for now only have 64 masters.
  • Each active connection will create 2 threads.
  • Not all slave variables are multi source ready.

See also:

  • The work in MariaDB is based on the project description at MDEV-253.
  • The original code base comes from Taobao, developed by Plinux. A big thanks to them for this important feature!

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.