MySQL physical level hot standby script

Source: Internet
Author: User

1#!/bin/Bash2mysql_backup_dir=/data/databaseup/3Mysql_username="Root"4mysql_password="Password"5Databasename="database1 Database2"6lastweek=$ (Date "+%y%m%d"-D"Last Week")7timestart=$ (Date '+%y%m%d%h%m%s')8Dataname=${mysql_backup_dir}${timestart}9logfile=${mysql_backup_dir}/full-${timestart}.logTen  One Echo "Start Backup ..."`Date` AInnobackupex--user= $mysql _username--password= $mysql _password--defaults-file=/ETC/MY.CNF--database="$databasename"--no-lock--stream=xbstream--tmpdir= $mysql _backup_dir--Sleep= $--throttle= ---compress--compress-threads= -$mysql _backup_dir > ${dataname}.xbstream2>"$logfile" -  - mkdir-P ${dataname} theXbstream-x < ${dataname}.xbstream-C ${dataname} -Innobackupex--decompress ${dataname}2>"$logfile" - Find${dataname}-name"*.QP"|Xargs RM-F -Innobackupex--defaults-file=/ETC/MY.CNF--user=root [email protected]--use-memory=4g--apply-log ${dataname}2>"$logfile" +  - Echo "Backup Complete ..."`Date` +  A Echo "Delete old backup ..."`Date` at  -CD ${mysql_backup_dir} &&ls|grep${lastweek} |Xargs RM-RF -  - Echo "Delete old backup complete ..."`Date`

MySQL physical level hot standby script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.