詳解經過xtrabackup 工具有份mysql 5.7

因爲以前服務器安裝的xtrabackup比較老的版本,不支持mysql 5.7的熱備,須要升級下版本或新服務器部署2.4.1版本。這裏咱們下載官網https://www.percona.com/downloads/XtraBackup/ 最新版2.4.4 工具,安裝並備份mysql 5.7。

安裝XtraBackuphtml

這裏很少作解釋了,以前文章有介紹如何安裝。 這裏主要說下常見報錯,好比我這裏今天遇到兩個:mysql

error: Failed dependencies:
libev.so.4()(64bit) is needed by percona-xtrabackup-24-2.4.4-1.el6.x86_64
libnuma.so.1()(64bit) is needed by percona-xtrabackup-24-2.4.4-1.el6.x86_64

(1) libev.so.4()(64bit) is needed by percona-xtrabackup-24-2.4.4-1..el6.x86_64解決辦法:linux

rpm -ivh  ftp://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/libev-4.15-1.el6.rf.x86_64.rpm

安裝上邊rpm包解決sql

(2)libnuma.so.1()(64bit) is needed by percona-xtrabackup-24-2.4.4-1.el6.x86_64解決辦法:shell

rpm  -ivh  http://mirror.centos.org/centos/6/os/x86_64/Packages/numactl-2.0.9-2.el6.x86_64.rpm

安裝上邊rpm包解決。centos

備份mysqlbash

這裏咱們寫一個shell腳本作備份服務器

#!/bin/bash
# mysql full back 
#date  2016.10.18
#author:21yunwei
 
time=`date +%F`
logfile="/data/bakup/mysql_full_bak_time.log"
fullbakup_logfile="/data/bakup/fullbakup_logfile.log"
mysql_bakdir="/data/bakup"
user=xxxxx
password=xxxxxxx
 
[ ! -d $mysql_bakdir ] && mkdir -p $mysql_bakdir
[ ! -e $logfile ] && touch $logfile
[ ! -e $fullbakup_logfile ] && touch $fullbakup_logfile
 
innobackupex --defaults-file=/etc/my.cnf --user=$user --password=$passsword--compress ${mysql_bakdir} 2>&1 >>$fullbakup_logfile
ret=$?
finishtime=`date +%Y%m%d_%H%M%S`
[ $ret -eq 0 ] && echo "Mysql fullbakup finished, time: $finishtime" >>  $logfile || echo "Mysql fullbakup failed,please check time:$finishtime" >> $logfile

本文地址:https://www.linuxprobe.com/xtrabackup-mysql.html工具

相關文章
相關標籤/搜索