Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Innobackupex in MySQL

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to use Innobackupex in MySQL. It is very detailed and has a certain reference value. Friends who are interested must finish it!

This script is a complete script for Innobackupex

Xtrabackup version: 2.4.3

# / bin/bash

# set variables

Path to conf=/XXX/my.cnf # my.cnf

User=

Password=

Socket=

Backupdir=

Name=fullback_ `date + "% Y%m%d-%H:%M:%S" `

Innobackupexlog=$ {backupdir} / log/innobackupexlog_ `date + "% Y%m%d-%H:%M:%S" `

Time of data retention for expire=7 # backups

# begin full backup

Innobackupex-- defaults-file=$ {conf}\

-- user=$ {user}\

-- password=$ {password}\

-- socket=$ {socket}\

-- slave-info\

-- no-timestamp ${backupdir} / ${name} & > > ${innobackupexlog}

Backupflag1= `tail-n 10 ${innobackupexlog} | grep "completed OK" | grep-v prints | wc-l`

If [${backupflag1}-eq 0]

Then

Echo "="

Echo "`date +" Y-%m-%d H:%M:%S "`backup failed!" > > ${innobackupexlog}

Echo "="

Exit 1

Elif [${backupflag1}-eq 1]

Then

Echo "= =" > > ${innobackupexlog}

Echo "backup success" > > ${innobackupexlog}

Echo "= =" > > ${innobackupexlog}

# begin recover redolog

Echo "= =" > > ${innobackupexlog}

Echo "`date +"% Y%m%d-%H:%M:%S "`Begin to Recover..." > ${innobackupexlog}

Echo "= =" > > ${innobackupexlog}

Innobackupex-- defaults-file=$ {conf}-- apply-log ${backupdir} / ${name} & > ${innobackupexlog}

Backupflag2= `tail-n 10 ${innobackupexlog} | grep "completed OK" | grep-v prints | wc-l`

If [${backupflag2}-gt 0]

Then

Echo "= =" > > ${innobackupexlog}

Echo "`date +"% Y%m%d-%H:%M:%S "`Recover is success!" > > ${innobackupexlog}

Echo "= =" > > ${innobackupexlog}

Else

Echo "= =" > > ${innobackupexlog}

Echo "Recover is failed!" > > ${innobackupexlog}

Echo "= =" > > ${innobackupexlog}

Exit 1

Fi

Fi

# clean expired backup

Find ${backupdir}-type d-name "fullback*"-mtime + ${expire} | xargs / bin/rm-rf

Find ${backupdir} / log-type f-name "innobackupexlog*"-mtime + ${expire} | xargs / bin/rm-rf

The above is all the contents of the article "how to use Innobackupex in MySQL". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report