xtrabackup备份方式搭建一个mysql slave
Posted Oops!
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xtrabackup备份方式搭建一个mysql slave相关的知识,希望对你有一定的参考价值。
[[email protected] ~]# cd /usr/src/
[[email protected] src]# wget http://www.percona.com/redir/downloads/XtraBackup/LATEST/binary/Linux/x86_64/percona-xtrabackup-2.1.5-680-Linux-x86_64.tar.gz
[[email protected] src]# tar zxvf percona-xtrabackup-2.1.5-680-Linux-x86_64.tar.gz
[[email protected] src]# cp percona-xtrabackup-2.1.5-Linux-x86_64/bin/* /data/mysql/bin/
[[email protected] DBD-mysql-4.023]# yum -y install perl-DBD-MySQL.x86_64
# wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.628.tar.gz
# tar zxvf DBI-1.628.tar.gz
# cd DBI-1.628
# perl Makefile.PL
# make && make install
# wget http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.023.tar.gz
# tar zxvf DBD-mysql-4.023.tar.gz
# cd DBD-mysql-4.023
# perl Makefile.PL --libs="-L/data/mysql/lib -lmysqlclient -lz -lrt -lcrypt -lnsl -lm" --cflags=" -I/data/mysql/include/"
# make && make install
[[email protected] data]# innobackupex --user=root --password= root --port=3306 --defaults-file=/etc/my.cnf --slave-info --socket=/data/mysql/data/mysql.sock --no-timestamp /data/backup/pis_slave
# innobackupex --apply-log /data/backup/pis_slave/
mysqld_safe --user=mysql --ledir=/data/mysql/bin/ &
[[email protected] pis_slave]# cat xtrabackup_slave_info
CHANGE MASTER TO MASTER_LOG_FILE=‘mysql-bin.012434‘, MASTER_LOG_POS=525181886
14:30:53 (none)>CHANGE MASTER TO
-> MASTER_HOST=‘10.0.2.44‘,
-> MASTER_USER=‘repl‘,
-> MASTER_PASSWORD=‘repl‘,
-> MASTER_PORT=3306,
-> MASTER_LOG_FILE=‘mysql-bin.012434‘,
-> MASTER_LOG_POS=525181886,
-> MASTER_CONNECT_RETRY=10;
14:33:00 (none)> start slave;
以上是关于xtrabackup备份方式搭建一个mysql slave的主要内容,如果未能解决你的问题,请参考以下文章
xtrabackup在线备份主库,搭建slave,使用gtid模式