bitsCN.com
mysql xtrabackup增量备份
稻草人企业站管理系统基于php+sqlite与php+mysql两个版本,php+sqlite特点和asp+access差不多,优点是利于备份,现在大多网站空间都支持php+sqlite。php+mysql特点是利于处理大量的数据,但备份和还原不方便。 网站特点: 1、程序分为php+sqlite、php+mysql两个版本 2、程序采用php+smarty模板技术 修改模板方便 3、程序采用面
0
mysql 增量备份策略 周一全备,其他增量备份,根据业务需要,设定保留日期,如保留一月。
增量备份步骤;
1 创建全备
2 根据全备目录,创建增量备份
3 第二次增量备份根据第一次增量备份目录,依次类推
下面是今天写的增量备份脚本,先在自己的测试机上跑几天。
#!/bin/shbegintime=`date +"%Y-%m-%d %H:%M:%S"`format_time=`date +"%Y-%m-%d_%H:%M:%S"`week=`date +%w`port=3306#ip=backdir=/backupfile_cnf=/etc/my.cnfuser_name=rootpasswd=out_log=$datadir/xtraback_log_$format_timetime_cost=$backdir/xtraback_time.txtif [ ! -d "$backdir" ]; then mkdir -p $backdir fi if [ -d "$backdir/rec5" ];then rm -rf $backdir-bak mv $backdir $backdir-bak mkdir $backdir fi#full backup if [ ! -d "$backdir/full" ];then echo "#####start full backup at $begintime to directory full" >>$time_cost innobackupex --defaults-file=$file_cnf --no-lock --no-timestamp --user=$user_name --port=3306 $backdir/full 1>$out_log-full 2>&1 tar -zcvf $backdir/full.tar.gz $backdir/full break; elif [ ! -d "$backdir/rec0" ];then echo "######start 0 incremental backup at $begintime to directory rec0" >>$time_cost innobackupex --default-file=$file_cnf --no-lock --no-timestamp --user=$user_name --port=$port --incremental --incremental-basedir=$backdir/full $backdir/rec0 1> $out_log-rec0 2>&1 break; elif [ ! -d "$backdir/rec1" ];then echo "#######start 1 incremental backup at $begintime to directory rec1" >>$time_cost innobackupex --defaults-file=$file_cnf --no-lock --no-timestamp --user=$user_name --port=port --incremental --incremental-basedir=$backdir/full $backdir/rec1 1>$out_log-rec1 2>&1 break; elif [ ! -d "$backdir/rec2" ]; then echo "######start 2 incremental backup at $begintime to directory rec2" >>$time_cost innobackupex --defaults-file=$file_cnf --no-lock --no-timestamp --user=$user_name --port=port --incremental --incremental-basedir=$backdir/rec1 $backdir/rec2 1> $out_log-rec2 2>&1 break; elif [ ! -d "$backdir/rec3" ]; then echo "#######start 3 incremental backup at $begintime to directory rec3" >$time_cost innobackupex --defaults-file=$file_cnf --no-lock --no-timestamp --user=root --port=port --incremental --incremental-basedir=$/backdir/rec2 $backdir/rec3 1> $out_log-rec3 2>&1 break; elif [! -d "$backdir/rec4" ];then echo "########start 4 incremental backup at $begintime to directory rec4" >>$time_cost innobackupex --defaults-file=$file_cnf --no-lock --no-timestamp --user=root --port=port --incremental --incremental-basedir=$backdir/rec4 1> $out_log-rec4 2>&1 break; elif [ ! -d "$backdir/rec5" ];then echo "#######start 5 incremental backup at $begintime to directory rec5" >>$time_cost / innobackupex --defaults-file=$file_cnf --no-lock --no-timestamp --user=$user_name --port=port --incremental --incremental-basedir=$backdir/rec4 $backdir/rec5 1> $out_log-rec5 2>&1 break; fi
还原步骤
1 关闭实例
2 应用日志,如有增量,先恢复全备,然后再逐个恢复增量日志
3 copy数据到目录
4 修改数据文件权限,chown、chmod
5 启动
bitsCN.com
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
C++高性能并发应用_C++如何开发性能关键应用
Java AI集成Deep Java Library_Java怎么集成AI模型部署
Golang后端API开发_Golang如何高效开发后端和API
Python异步并发改进_Python异步编程有哪些新改进
C++系统编程内存管理_C++系统编程怎么与Rust竞争内存安全
Java GraalVM原生镜像构建_Java怎么用GraalVM构建高效原生镜像
Python FastAPI异步API开发_Python怎么用FastAPI构建异步API
C++现代C++20/23/26特性_现代C++有哪些新标准特性如modules和coroutines
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号