xtrabackup安装备份mysql

第一步下载安装xtrabackup

[root@node src]# wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.12/binary/redhat/7/x86_64/percona-xtrabackup-24-2.4.12-1.el7.x86_64.rpm
# 下载好以后,需要依赖,使用yum本地安装,解决依赖关系;
[root@node src]# yum localinstall percona-xtrabackup-24-2.4.12-1.el7.x86_64.rpm
[root@node src]# xtrabackup -version

 

 

#!/bin/bash
user=root
passwd=root
DATE=`date +"%Y/%F-%T"`
fullback=/home/backup/full/$DATE
[ ! -d $fullback ] && mkdir $fullback -p
xtrabackup  --user=$user --password=$passwd  --backup  --target-dir=$fullback &> /tmp/mysql
egrep ".* Backup created in directory.*" /tmp/mysql >> /home/backup/full/complete.info
#scp -rp $fullback 192.168.1.188:/fullback
find $fullback/  -ctime +3 -type d -exec rm {} \;
 

你可能感兴趣的:(xtrabackup安装备份mysql)