使用Percona XtraBackup备份工具创建MySQL Slave

使用Percona XtraBackup备份工具创建MySQL Slave

在原来搭建MySQL Slave如果可以停同步停库对应用响应要求不高,直接拷贝数据到新备库,配置好后在启用同步就可以了.但是在一些紧急情况下:比如业务超级繁忙的系统,数据库和同步又不能停去做一个MySQL Slave,这个时候XtraBackup就派上用场了.

下面重点介绍用XtraBackup做MySQL Slave的步骤

一、安装XtraBackup
[mysql@localhost backup]$ ll /etc/yum.repos.d/Percona.repo 
-rw-r--r--. 1 root root 189 Dec 10 10:33 /etc/yum.repos.d/Percona.repo

[mysql@localhost ~]$ sudo yum install xtrabackup

二、用XtraBackup创建一个完全备份

[mysql@localhost ~]$ innobackupex-1.5.1 --user=root --password=root --port=3306 --defaults-file=/etc/my.cnf --slave-info  --no-timestamp /mysql/backup

备份完成后会显示如下信息:

xtrabackup: Creating suspend file '/mysql/backup/xtrabackup_suspended_2' with pid '2963'

140209 11:31:21  innobackupex: Continuing after ibbackup has suspended
140209 11:31:21  innobackupex: Starting to lock all tables...
140209 11:31:21  innobackupex: All tables locked and flushed to disk
140209 11:31:21  innobackupex: Failed to get master binlog coordinates from SHOW SLAVE STATUS
140209 11:31:21  innobackupex: This means that the server is not a replication slave. Ignoring the --slave-info option

140209 11:31:21  innobackupex: Starting to backup non-InnoDB tables and files
innobackupex: in subdirectories of '/mysql/data'
innobackupex: Backing up file '/mysql/data/test/heartbeat.frm'
innobackupex: Backing up files '/mysql/data/performance_schema/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (53 files)
>> log scanned up to (4879018460)
innobackupex: Backing up file '/mysql/data/percona/test.frm'
innobackupex: Backing up file '/mysql/data/percona/db.opt'
innobackupex: Backing up files '/mysql/data/mysql/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' (74 files)
140209 11:31:21  innobackupex: Finished backing up non-InnoDB tables and files

140209 11:31:21  innobackupex: Waiting for log copying to finish

xtrabackup: The latest check point (for incremental): '4879018460'
xtrabackup: Stopping log copying thread.
.>> log scanned up to (4879018460)

xtrabackup: Creating suspend file '/mysql/backup/xtrabackup_log_copied' with pid '2963'
xtrabackup: Transaction log of lsn (4879018460) to (4879018460) was copied.
140209 11:31:22  innobackupex: All tables unlocked

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值