MySQL 备份工具 XtraBackup 系列4 --- 定时任务

一、承上启下

1. XtraBackup安装

https://www.cnblogs.com/eagle6688/p/17066856.html

2. XtraBackup备份

https://www.cnblogs.com/eagle6688/p/17072925.html

3. XtraBackup备份脚本

https://www.cnblogs.com/eagle6688/p/17073009.html

4. Crontab

https://www.cnblogs.com/eagle6688/p/17019244.html

二、Crontab

1. 定时任务脚本

(1) 创建脚本

我们会在/etc/cron.hourly目录创建定时任务脚本,这样该脚本会每小时执行一次:

sudo vi /etc/cron.hourly/mysql-backup

(2) 初始化内容

#!/bin/bash
sudo -u bkpuser systemd-cat --identifier=mysql-backup /usr/local/bin/MySQL-Backup.sh

(3) 赋权

sudo chmod +x /etc/cron.hourly/mysql-backup

(4) 手动测试

sudo /etc/cron.hourly/mysql-backup

(5) 检查输出

sudo journalctl -t mysql-backup

三、参考

1. 官方

https://docs.percona.com/percona-xtrabackup/8.0/index.html

2. 其他

https://www.digitalocean.com/community/tutorials/how-to-create-hot-backups-of-mysql-databases-with-percona-xtrabackup-on-centos-7

https://www.digitalocean.com/community/tutorials/how-to-configure-mysql-backups-with-percona-xtrabackup-on-ubuntu-16-04

https://severalnines.com/blog/mysqldump-or-percona-xtrabackup-backup-strategies-mysql-galera-cluster/

posted @ 2023-01-29 16:25  白马黑衣  阅读(249)  评论(0编辑  收藏  举报