增量式备份

This commit is contained in:
zhangkun9038@dingtalk.com 2023-07-14 17:29:53 +08:00
parent 057bdbb930
commit acc50f23f3

View File

@ -14,6 +14,12 @@ LAST_BACKUP=$(cat "$backUpPath/last_backup.txt")
LAST_BINLOG=$(echo "$LAST_BACKUP" | awk '{print $1}')
LAST_POSITION=$(echo "$LAST_BACKUP" | awk '{print $2}')
# 如果是第一次运行,设置初始值
if [[ -z "$LAST_BACKUP" ]]; then
LAST_BINLOG="none"
LAST_POSITION="0"
fi
# 获取当前binlog文件名和位置
CURRENT_BINLOG=$(mysql -u$userName -p$password -h$host -e "SHOW MASTER STATUS" | awk '{print $1}')
CURRENT_POSITION=$(mysql -u$userName -p$password -h$host -e "SHOW MASTER STATUS" | awk '{print $2}')