innobackupex中--slave-info参数的含义和适用场景

我有个问题一直没弄明白,就是innobackupex里面的--slave-info这个参数,是干什么的呀。最终在命令帮助和我的实验,弄清楚了其中的含义。
    下面就是一个我经常用来备份全库时的语句:
innobackupex --defaults-file=/etc/my.cnf --user=root --password='123' --host=localhost --rsync --compress --compress-threads=5 --compress-chunk-size=64K --slave-info /root

    下面我们就看帮助,看一下其中这个--slave-info的含义:
[root@zabbixsrvbjdb04 ~]# innobackupex --help |grep -C 5 slave
 --slave-info
        This option is useful when backing up a replication slave server. It
        prints the binary log position and name of the master server. It
        also writes this information to the "xtrabackup_slave_info" file as
        a "CHANGE MASTER" command. A new slave for this master can be set up
        by starting a slave server on this backup and issuing a "CHANGE
        MASTER" command with the binary log position saved in the
        "xtrabackup_slave_info" file.

    以下就是我的理解:
    在备份从库时,可以使用该参数, 加上--slave-info备份目录下会多生成一个xtrabackup_slave_info 文件, 这里会保存主日志文件以及偏移, 文件内容类似于:CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=0。
    这个参数适用的场景:假设现在有主库A和从库B,目前想再添加一台备库C,并让备库C以主库A为master;因为主库A是生产库,压力一般比较大,所以我们就在备库B上备份一个数据库,然后把这个备份拿到C服务器上 并导入到C库,接下来再在C服务器上执行change master的命令:其中 master_host是A的ip,而master_log_file和master_log_pos就是这个xtrabackup_slave_info里面的值。不知道说明白了吗(czxin注释)。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值