In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following content mainly brings you to record mysql backup script, the knowledge here is slightly different from books, are summed up by professional and technical personnel in the process of contact with users, have a certain experience sharing value, hope to bring help to the majority of readers.
Mysql backup script, record:
Complete:
#! / bin/sh set-x USER=root PASSWORD=123456time= `date + "% y-%m-%d-%H-%M" `date > > / data/mysqlbackup/logs/$time'_allbackup.log' # 1 begin Full Backups echo "begin backup--" > > / data / mysqlbackup/logs/$time'_allbackup.log' / usr/bin/innobackupex-defaults-file=/etc/my.cnf-- user=$USER-- password=$PASSWORD-- use-memory=2GB-- parallel=4-- no-timestamp / data/mysqlbackup/full-$time 2 > > / data/mysqlbackup/logs/$time'_allbackup.log' cp / etc/my.cnf / data/mysqlbackup/full-$time/my.cnf.bkecho "end backup- -"> > / data/mysqlbackup/logs/$time'_allbackup.log' # 2 begin compress echo" Begin compress-- "> / data/mysqlbackup/logs/$time'_allbackup.log' archivename=full-$timeecho" The archive time is $time "> > / data/mysqlbackup/logs/$time'_allbackup.log' tarname=$archivename.tar.gz echo "The tarname is $tarname" > > / data/mysqlbackup/logs/$time'_allbackup.log'cd / data/mysqlbackup/bin/tar-zcvf. / $tarname. / $archivename > > / data/mysqlbackup/logs/$time'_allbackup.log' 2 > & 1rm-rf / data/mysqlbackup/full/xtrabackup_checkpoints cp / data/mysqlbackup/full-$time/xtrabackup_checkpoints / data/mysqlbackup/full/xtrabackup_checkpoints
# 3 Delete Documentfile=/data/mysqlbackup/$tarnameif [[- e $file]] then echo "The $tarname file exists.begin to perform delete action" > > / data/mysqlbackup/logs/$time'_allbackup.log' / bin/rm-rf / data/mysqlbackup/$archivename else echo "The file is not exists." > / data/mysqlbackup/logs/$time'_allbackup.log' fidate > > / data/mysqlbackup/logs/$time'_allbackup.log'find / data/ Mysqlbackup/*tar.gz-ctime + 1 | xargs-I'{}'mv {} / data/ftpcd / data/ftpfunction logftp () {ftp-v-n xxx.xxx.xxx.xxx > / data/mysqlbackup/logs/to_ftp.logcd / data/ftpfind / data/ftp/*tar.gz | xargs rm-rf
Incremental backup:
#! / bin/shset-xUSER=rootPASSWORD=123456time= `date + "% y-%m-%d-%H-%M" `date > > / data/mysqlbackup/logs/$time'_incre.log'#1 begin Incre Backupsecho "begin backup--" > > / data/mysqlbackup/logs/$time'_incre.log' / usr/bin/innobackupex-- defaults-file=/etc/my.cnf-- user=$USER -- password=$PASSWORD-- incremental--incremental-basedir=/data/mysqlbackup/full-- use-memory=2GB-- safe-slave-backup-- parallel=4-- slave-info-- no-timestamp / data/mysqlbackup/incre-$time 2 > > / data/mysqlbackup/logs/$time'_incre.log'cp / etc/my.cnf / data/mysqlbackup/incre-$time/my.cnf.bkecho "end backup-- -"> / data/mysqlbackup/logs/$time'_incre.log'#2 begin compressecho" Begin compress-- "> > / data/mysqlbackup/logs/$time'_incre.log' archivename=incre-$timeecho" The archive time is $time "> > / data/mysqlbackup/logs/$time'_incre.log' tarname=$archivename.tar.gzecho" The tarname is $tarname "> > / data/mysqlbackup / logs/$time'_incre.log'cd / data/mysqlbackup//bin/tar-zcvf. / $tarname. / $archivename > > / data/mysqlbackup/logs/$time'_incre.log' 2 > & 1x3 Delete Documentfile=/data/mysqlbackup/$tarnameif [[- e $file]] then echo "The $tarname file exists.begin to perform delete action" > > / data/mysqlbackup/logs/$time'_incre.log' / bin/rm-rf / data/mysqlbackup/$archivename else Echo "The file is not exists." > > / data/mysqlbackup/logs/$time'_incre.log' fidate > > / data/mysqlbackup/logs/$time'_incre.log'find / data/mysqlbackup/*tar.gz-ctime + 1 | xargs-I'{}'mv {} / data/ftpcd / data/ftpfunction logftp () {ftp-v-n xxx.xxx.xxx.xxx > / data/mysqlbackup/logs/to_ftp.logcd / data/ftpfind / data/ftp/*tar.gz | xargs rm-rf
For the above recording mysql backup script, if you need to know more, you can continue to follow our industry promotion, if you need professional answers, you can contact the pre-sales and after-sales on the official website. I hope this article can bring you some knowledge updates.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.