I'm trying to backup a MariaDB server which is a slave (of a multi-source replication), however innobackupex doesn't detect it as such:
-------------------------------------------------------------------------------------------------
150122 10:28:53 innobackupex: Continuing after ibbackup has suspended
innobackupex:: Not checking slave open temp tables for --safe-slave-backup because host is not a slave
-------------------------------------------------------------------------------------------------
Looking at how the detection is done, I can understand why it says so:
-------------------------------------------------------------------------------------------------
sub get_mysql_slave_status {
mysql_query($_[0], "SHOW SLAVE STATUS");
}
...
get_mysql_slave_status($con);
if (defined($con->{slave_status}->{Read_Master_Log_Pos}) and defined($con->{slave_status}->{Slave_SQL_Running})) { $host_is_slave = 1;
}
-------------------------------------------------------------------------------------------------
Indeed, SHOW SLAVE STATUS has empty output on this server:
-------------------------------------------------------------------------------------------------
MariaDB [(none)]> SHOW SLAVE STATUS;
Empty set (0.00 sec)
-------------------------------------------------------------------------------------------------
In particular, SHOW SLAVE STATUS only show a *default* replication, which is not mandatory to have.
You can in addition have others replications defined, all of which have a connection_name that you need to add to the command in order to have more info:
-------------------------------------------------------------------------------------------------
MariaDB [(none)]> SHOW SLAVE 'instance7-XXXXXXXXX' STATUS\G
*************************** 1. row *************************** Slave_IO_State: Waiting for master to send event
...
-------------------------------------------------------------------------------------------------
You can also use the SHOW ALL SLAVES STATUS to have info on all the slaves defined:
-------------------------------------------------------------------------------------------------
MariaDB [(none)]> show all slaves status\G
*************************** 1. row *************************** Connection_name: instance1-XXXXX Slave_SQL_State: Slave has read all relay log; waiting for the slave I/O thread to update it
-------------------------------------------------------------------------------------------------
This surely has multiple implications for Xtrabackup to support this multi-source replication:
- Detection can be easy : checking server version, using SHOW ALL SLAVE STATUS to detect multi-source replication and acting as such.
- Stopping / restarting slave(s) needs to be enhanced to iterate on all active slave(s) connections.
- The CHANGE MASTER commands may also need to be handled (may be differently if the connection is in GTID or non-GTID mode)
There may also be other implications that I did not thought of.
-------------------------------------------------------------------------------------------------
$ cat /etc/redhat-release
CentOS release 6.6 (Final)
-------------------------------------------------------------------------------------------------
$ rpm -q percona-xtrabackup
percona-xtrabackup-2.2.8-5059.el6.x86_64
-------------------------------------------------------------------------------------------------
$ innobackupex --version
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013. All Rights Reserved.
-------------------------------------------------------------------------------------------------
$ xtrabackup --version
xtrabackup version 2.2.8 based on MySQL server 5.6.22 Linux (x86_64) (revision id: )
-------------------------------------------------------------------------------------------------
$ mysql --version
mysql Ver 15.1 Distrib 10.0.15-MariaDB, for Linux (x86_64) using readline 5.1
-------------------------------------------------------------------------------------------------
I'm trying to backup a MariaDB server which is a slave (of a multi-source replication), however innobackupex doesn't detect it as such:
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------ ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------
150122 10:28:53 innobackupex: Continuing after ibbackup has suspended
innobackupex:: Not checking slave open temp tables for --safe-slave-backup because host is not a slave
-------
Looking at how the detection is done, I can understand why it says so: ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------ slave_status { query($ _[0], "SHOW SLAVE STATUS"); mysql_slave_ status( $con);
-------
sub get_mysql_
mysql_
}
...
get_
if (defined( $con->{ slave_status} ->{Read_ Master_ Log_Pos} ) and
defined( $con->{ slave_status} ->{Slave_ SQL_Running} )) {
$host_ is_slave = 1; ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------
}
-------
Indeed, SHOW SLAVE STATUS has empty output on this server:
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------ ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------
MariaDB [(none)]> SHOW SLAVE STATUS;
Empty set (0.00 sec)
-------
This is because, on MariaDB >= 10.0.1, multi-source replication changes things a bit: https:/ /mariadb. com/kb/ en/mariadb/ documentation/ managing- mariadb/ replication/ standard- replication/ multi-source- replication/
In particular, SHOW SLAVE STATUS only show a *default* replication, which is not mandatory to have.
You can in addition have others replications defined, all of which have a connection_name that you need to add to the command in order to have more info:
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------ XXXXXXXXX' STATUS\G ******* ******* ****** 1. row ******* ******* ******* ******
Slave_ IO_State: Waiting for master to send event ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------
MariaDB [(none)]> SHOW SLAVE 'instance7-
*******
...
-------
You can also use the SHOW ALL SLAVES STATUS to have info on all the slaves defined:
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------ ******* ******* ****** 1. row ******* ******* ******* ******
Connection_ name: instance1-XXXXX
Slave_SQL_ State: Slave has read all relay log; waiting for the slave I/O thread to update it ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------
MariaDB [(none)]> show all slaves status\G
*******
-------
This surely has multiple implications for Xtrabackup to support this multi-source replication:
- Detection can be easy : checking server version, using SHOW ALL SLAVE STATUS to detect multi-source replication and acting as such.
- Stopping / restarting slave(s) needs to be enhanced to iterate on all active slave(s) connections.
- The CHANGE MASTER commands may also need to be handled (may be differently if the connection is in GTID or non-GTID mode)
There may also be other implications that I did not thought of.
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------ ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------ xtrabackup- 2.2.8-5059. el6.x86_ 64 ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------ ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------ ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------ ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------
$ cat /etc/redhat-release
CentOS release 6.6 (Final)
-------
$ rpm -q percona-xtrabackup
percona-
-------
$ innobackupex --version
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013. All Rights Reserved.
-------
$ xtrabackup --version
xtrabackup version 2.2.8 based on MySQL server 5.6.22 Linux (x86_64) (revision id: )
-------
$ mysql --version
mysql Ver 15.1 Distrib 10.0.15-MariaDB, for Linux (x86_64) using readline 5.1
-------