Create a MySQL slave library using Percona xtrabackup

Source: Internet
Author: User
Tags percona

MySQL Server Version:

Server version: 5.7.10-log MySQL Community Server (GPL)

Percona xtrabackup Version:

Innobackupex version 2.4.2 Linux (x86_64) (revision id:8e86a84)

Description

[Master]: Represents a statement executed on the master library [slave]: Represents a statement executed on the slave library

--Perform a master library full-ready
[Master]innobackupex--parallel=4/data/backup/full--no-timestamp
--Attach the log to the backup [Master]innobackupex--apply-log--parallel=4/data/backup/full--no-timestamp
--Create the replication user [master]create user ' repl ' @ ' 172.25.21.% ' identified by ' repl ';
--Grant Copy user replication permissions [master]grant replication Slave on * * to ' repl ' @ ' 172.25.21.% ';
--Compress the backed up data [Master]tar-cvzf full.tar.gz full/
--Transfer data to Slave library [master]scp full.tar.gz [Email protected]:/data/backup/

--Unzip the backup data transferred from the main library.
[Slave]tar xzvf/data/backup/full.tar.gz
--Test whether users created with the main library can connect to the main library [SLAVE]MYSQL-H172.25.21.11-UREPL-PREPL
--View information for binary log in backup data [Slave]cat/data/backup/full/xtrabackup_binlog_info mysql-bin.000002 66379412

--Perform a backup restore operation [Slave]innobackupex--copy-back/data/backup/full
--Modify the permissions of the recovered data file directory [Slave]chown-r mysql:mysql/data/mysql_data1
--Start slave library [Slave]service mysqld start

--Log into the slave library and execute the following statement to turn on synchronization

Change Master to
Master_host= ' 172.25.21.11 ',
Master_user= ' Repl ',
Master_password= ' Repl ',
master_port=3306,
Master_log_file= ' mysql-bin.000002 ',
master_log_pos=66379412;

Start slave;

show slave status\g;

Create a MySQL slave library using Percona xtrabackup

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.