增量式备份
This commit is contained in:
parent
975f2b2507
commit
7b36747e8c
@ -15,17 +15,18 @@ LAST_BINLOG=$(echo "$LAST_BACKUP" | awk '{print $1}')
|
|||||||
LAST_POSITION=$(echo "$LAST_BACKUP" | awk '{print $2}')
|
LAST_POSITION=$(echo "$LAST_BACKUP" | awk '{print $2}')
|
||||||
|
|
||||||
# 如果是第一次运行,设置初始值
|
# 如果是第一次运行,设置初始值
|
||||||
|
|
||||||
|
|
||||||
|
# 获取当前binlog文件名和位置
|
||||||
|
CURRENT_BINLOG=$(mysql -u$userName -p$password -h$host -N -e "SHOW MASTER STATUS" | awk '{print $1}')
|
||||||
|
CURRENT_POSITION=$(mysql -u$userName -p$password -h$host -N -e "SHOW MASTER STATUS" | awk '{print $2}')
|
||||||
|
|
||||||
if [[ -z "$LAST_BACKUP" ]]; then
|
if [[ -z "$LAST_BACKUP" ]]; then
|
||||||
LAST_BINLOG="0"
|
LAST_BINLOG=$CURRENT_BINLOG
|
||||||
LAST_POSITION="0"
|
LAST_POSITION="0"
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# 获取当前binlog文件名和位置
|
|
||||||
CURRENT_SBINLOG=$(mysql -u$userName -p$password -h$host -N -e "SHOW MASTER STATUS" | awk '{print $1}')
|
|
||||||
CURRENT_BINLOG=$(mysql -u$userName -p$password -h$host -N -e "SHOW MASTER STATUS" | awk '{print substr($1, 4)}')
|
|
||||||
CURRENT_POSITION=$(mysql -u$userName -p$password -h$host -N -e "SHOW MASTER STATUS" | awk '{print $2}')
|
|
||||||
|
|
||||||
echo current_binlog $CURRENT_BINLOG
|
echo current_binlog $CURRENT_BINLOG
|
||||||
echo current_binPostition $CURRENT_POSITION
|
echo current_binPostition $CURRENT_POSITION
|
||||||
# 备份增量变更到文件
|
# 备份增量变更到文件
|
||||||
|
Loading…
x
Reference in New Issue
Block a user