Mariadb 10.3 using mariabackup backup master structures from

mariabackup is Mariadb xtrabackup on the basis of a new branch, with default mariadb been installed.

1. Create a Master Account main library

grant replication slave on *.* to 'repl'@'%' identified by "repl"

2. Main library mariabackup create full backup

mkdir -p /data/mariabackup
mariabackup --backup --target-dir=/data/mariabackup -S /var/lib/mysql/mysql.sock -uroot -p123456

3. Prepare backup data

mariabackup --prepare --target-dir=/data/mariabackup

4. transmitting the backup data from the library to
Note: mysql service from the library needs to close, and all the data will be deleted from the database
from a repository location data / var / lib / mysql

cd /data/mariabackup
rsync -av . slave_hostip:/var/lib/mysql

5. Start the database from the library service
Note: Starting from the front of the library, the library needs from INNODB configuration files and backup files in the backup-my.cnf Lane has been, or may not start database

# This MySQL options file was generated by innobackupex.

# The MySQL server
[mysqld]
innodb_checksum_algorithm=crc32
innodb_data_file_path=ibdata1:12M:autoextend
innodb_log_files_in_group=2
innodb_log_file_size=50331648
innodb_page_size=16384
innodb_undo_directory=./
innodb_undo_tablespaces=0

Start from the library

systemctl start mysql

6. Set master and slave from the library
to view the backup files in the xtrabackup_binlog_info

mysql-bin.000248        17358780        0-155-1993077

From the above we know BINLOG file from the library and set the starting position of the copy

change master to master_host='master_server', master_port=3306,master_user='repl',master_password='repl',MASTER_LOG_FILE='mysql-bin.000248', MASTER_LOG_POS=17358780;

Note: The backup file has
BINLOG xtrabackup_binlog_info --- database and the starting position
INNODB of xtrabackup_binlog_pos_innodb --- database BINLOG and the starting position
information xtrabackup_info --- database backup

Normally, if a server is INNODB database storage engine, the xtrabackup_binlog_info and xtrabackup_binlog_pos_innodb file is the same,
but there are other storage engines if the server instance myisam, the xtrabackup_binlog_info starting position than xtrabackup_binlog_pos_innodb large. So we chose the location in memory of xtrabackup_binlog_info

Guess you like

Origin blog.51cto.com/fengwan/2462453