增量式备份
This commit is contained in:
		
							parent
							
								
									c8ad2590cd
								
							
						
					
					
						commit
						d27e64e34c
					
				@ -39,7 +39,7 @@ cd $backUpPath
 | 
			
		||||
    docker exec maria /usr/bin/mysqlbinlog -u${userName} -p${password} -h${host} --start-position=${LAST_POSITION} --stop-position=${CURRENT_POSITION} /var/lib/mysql/$LAST_BINLOG > ${backUpPath}/${dbName}-incremental-${LAST_POSITION}-${CURRENT_POSITION}-${currentTime}.sql
 | 
			
		||||
    zip ${backUpPath}/${dbName}-incremental-${LAST_POSITION}-${CURRENT_POSITION}-${currentTime}.sql.zip ${backUpPath}/${dbName}-incremental-${LAST_POSITION}-${CURRENT_POSITION}-${currentTime}.sql
 | 
			
		||||
    rm ${backUpPath}/${dbName}-incremental-${LAST_POSITION}-${CURRENT_POSITION}-${currentTime}.sql
 | 
			
		||||
    ossutil cp ${dbName}-incremental-${LAST_POSITION}-${CURRENT_POSITION}-${currentTime}.sql.zip $ossPath/$file
 | 
			
		||||
    ossutil cp ${dbName}-incremental-${LAST_POSITION}-${CURRENT_POSITION}-${currentTime}.sql.zip  oss://$ossPath/$file
 | 
			
		||||
#fi
 | 
			
		||||
# 更新上次备份的binlog文件名和位置
 | 
			
		||||
echo "$CURRENT_BINLOG $CURRENT_POSITION" > "last_backup.txt"
 | 
			
		||||
@ -93,5 +93,5 @@ done
 | 
			
		||||
for file in "${OLD_BACKUPS[@]}"; do
 | 
			
		||||
    echo "$file"
 | 
			
		||||
    rm $file
 | 
			
		||||
    ossutil rm $ossPath/$file
 | 
			
		||||
    ossutil rm oss://$ossPath/$file
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user