[Email protected] ~]# CD/USR/LOCAL/SRC
[Email protected] src]# tar zxvf percona-xtrabackup-2.4.4-linux-x86_64.tar.gz-c/usr/local
[Email protected] src]# cd/usr/local
[Email protected] local]# MV Percona-xtrabackup-2.4.4-linux-x86_64/xtrabackup
[Email protected] local]# chown mysql-r xtrabackup/
[Email protected] ~]# Su-mysql
[Email protected] ~]$ Vi. bash_profile
Path= $PATH:/usr/local/xtrabackup/bin
[[email protected] ~]$ source. bash_profile
[Email protected] ~]# mkdir-p/usr/local/mysql/backup
[Email protected] ~]# chown-r mysql/usr/local/mysql/backup
[Email protected] ~]# Su-mysql
[Email protected] ~]$ VI full_backup.sh
#!/bin/bash
User= ' Root '
Passwd= ' abcd.1234 '
my_config= '/etc/my.cnf '
Backup_dir= '/usr/local/mysql/backup '
If [-f ~/.bash_profile];
Then
. ~/.bash_profile
Fi
Innobackupex--defaults-file= $my _config--user= $user--password= $passwd $backup _dir
[Email protected] ~]$ chmod a+x full_backup.sh
[Email protected] ~]$./full_backup.sh
[Email protected] ~]$ cd/usr/local/mysql/backup/
[email protected] backup]$ LL
[Email protected] backup]$ CD 2018-02-07_15-31-40/
[email protected] 2018-02-07_15-31-40]$ LL
[Email protected] ~]$ VI incr_backup.sh
#!/bin/bash
User= ' Root '
Passwd= ' abcd.1234 '
my_config= '/etc/my.cnf '
Backup_dir= '/usr/local/mysql/backup '
last_day=$ (date-d "1 days Ago" +%y-%m-%d)
filename=$ (Find $backup _dir-name "$last _day*"-print|awk-f/' {print $NF} ')
If [-f ~/.bash_profile];
Then
. ~/.bash_profile
Fi
Innobackupex--defaults-file= $my _config--user= $user--password= $passwd--incremental--incremental-basedir= $backup _dir/$filename $backup _dir
[Email protected] ~]$ chmod a+x incr_backup.sh
[Email protected] ~]$ CRONTAB-E
XX 3 * * 0/home/mysql/full_backup.sh>/usr/local/mysql/backup/full_backup.log 2>&1
XX 3 * * 1-6/home/mysql/incr_backup.sh>/usr/local/mysql/backup/incr_backup.log 2>&1
[Email protected] ~]$ crontab-l
XX 3 * * 0/home/mysql/full_backup.sh>/usr/local/mysql/backup/full_backup.log 2>&1
XX 3 * * 1-6/home/mysql/incr_backup.sh>/usr/local/mysql/backup/incr_backup.log 2>&1
MYSQL 5.6 Backup Transcript--Percona Xtrabackup