KunlunBase备份和恢复

全局一致性物理备份&恢复基本概念

物理备份:数据库的物理文件(数据文件,交易日志文件,参数文件)的备份。物理备份又可以分为脱机备份(冷备份)和联机备份(热备份)。

KunlunBase集群支持联机备份,备份过程中,数据库处于运行状态,应用程序读写不会阻塞,由于备份操作发生在主从节点的从节点上,对应用程序的性能基本没有影响。

一、备份恢复架构

备份恢复目标:存储集群和元数据集群

备份恢复调度中心:Cluster manager

备份数据保存:备份存储池

集群备份执行单元:Node Manager

二、基本原理

KunlunBase 集群备份&恢复工作原理

2.1 备份数据目标

在KunlunBase分布式数据库集群中的元数据集群存放整个集群的节点信息、表结构信息、事务信息、备份恢复信息等,是集群正常运行的基础, 元数据集群采用一主两从的高可用架构。

存储集群负责存放业务数据,数据分布在数据分片中(shards),存储集群由多个分片组成,每个分片有多个副本。

计算节点的数据是元数据集群数据的子集,计算节点本身无状态,不需要单独备份。

全局一致性备份可以对整个集群的数据全部备份(备份全部的元数据和存储集群数据),  也可以只备份部分数据,如只备份某个存储分片。

2.2 全局一致性备份和恢复

备份:在执行备份的开始阶段,备份恢复管理器从元数据库获取整个集群的全局事务信息,然后启动备份,对每个备份目标,同时需要备份目标数据的数据文件和交易日志。数据库文件和备份期间的交易日志被集中存放到备份资源池(存储),所有文件复制完成后,备份结束。备份信息记录在元数据库中。备份期间集群正常运行,不需要停业务。

恢复:在执行恢复的开始阶段,备份恢复管理器从元数据库获取当前可用的备份信息,然后从备份资源池复制数据到恢复的目标,数据复制完成后,根据交易日志执行事务的回滚或前滚,从而将整个集群恢复到一致状态。

2.3 备份类型

完全备份:备份备份目标的全部数据(数据文件及交易日志),是增量备份的基础。

增量备份:备份上次备份以来的增量数据及交易日志。

全部备份:备份整个集群的数据(元数据及全部的存储集群数据)。

部分备份:只备份某个分片的数据。

2.4 恢复类型

全部恢复:恢复整个集群

部分恢复:只恢复某个分片

基于时间的恢复:恢复到某个时间点

基于事务的恢复:基于某个事务编号的恢复

三、执行步骤

备份

3.1 设置备份策略

确定备份对象, 备份类型,备份目标存储准备。

3.2 执行备份

通过命令行或UI(KunlunBase 提供Web 界面)调度备份


[kunlun@kunlun-test6 util]$ backup --help
Usage of backup:
  -HdfsNameNodeService string
        specify the hdfs name node service, hdfs://ip:port
  -backuptype string
        back up storage node or 'compute' node,default is 'storage' (default "storage")
  -clustername string
        name of the cluster to be backuped
  -coldstoragetype string
        specify the coldback storage type: hdfs .. (default "hdfs")
  -etcfile string
        path to the etc file of the mysql instance to be backuped,
        if port is specified and the related instance is running,
        the tool will determine the etcfile path
  -port string
        the port of mysql or postgresql instance which to be backuped
  -shardname string
        name of the current shard
  -workdir string
        where store the backup data locally for temp use (default "./data")

3.3 检查备份结果,确认备份成功

恢复

3.4 设置恢复策略

确定恢复对象, 备份类型,备份目标存储准备

3.5 执行恢复

恢复操作指令:

[kunlun@kunlun-test6 util]$ restore --help
Usage of restore:
  -HdfsNameNodeService string
        specify the hdfs name node service, hdfs://ip:port
  -enable-globalconsistent
        whether restore the new mysql under global consistent restrict
  -metaclusterconnstr string
        current meta cluster connection string e.g. user:pass@tcp(ip:port)/mysql
  -mysqletcfile string
        etc file of the mysql which to be restored, if port is provied and mysqld is alive ,no need
  -origclustername string
        source cluster name to be restored or backuped
  -origmetaclusterconnstr string
        orig meta cluster connection string e.g. user:pass@tcp(ip:port)/mysql
  -origshardname string
        source shard name to be restored
  -port string
        the port of mysql/postgresql instance which to be restored and needed to be running state
  -restoretime string
        time point the new mysql restore to
  -restoretype string
        restore storage node or 'compute' node,default is 'storage' (default "storage")
  -workdir string
        temporary work path to store the coldback or other type files if needed (default "./data")

3.6 检查恢复结果,确认恢复成功

四、集群备份恢复演示

演示如何在kunlunDB  UI 界面做集群的备份和恢复

环境信息:

需要备份的集群由一个计算节点,一个shard (每个shard 由一主两从三个节点组成)及元数据集群组成(一主两从)

备份前数据状态:

第一步:启动备份

备份操作:点击集群管理界面的备份按钮,启动备份。

第二步:检查备份状态

根据执行时间, 备份成功后, 可以看到:backupcluster succeed信息。

第三步:恢复集群

选择恢复的时间点,然后确定恢复。

集群进入恢复状态:

恢复完成后,系统会在可用的资源区内创建一个新的集群, 并且恢复备份的数据。

恢复状态:

恢复的集群:

进入恢复的集群计算节点,查看恢复的数据:

集群恢复后, 相应的数据也正确恢复。

项目已开源

【GitHub:】
https://github.com/zettadb

【Gitee:】
https://gitee.com/zettadb

原文链接:

KunlunBase (昆仑数据库)备份和恢复 - Powered by MinDocicon-default.png?t=M666http://www.kunlunbase.com:8181/docs/b/b-1dnbmn5i3p83n

推荐阅读:

KunlunBase架构介绍 - Powered by MinDoc (kunlunbase.com)icon-default.png?t=M666http://www.kunlunbase.com:8181/docs/b/b-1dnl0ff08vm42KunlunBase技术优势介绍 - Powered by MinDoc (kunlunbase.com)icon-default.png?t=M666http://www.kunlunbase.com:8181/docs/b/b-1dnl0hidnehicKunlunBase技术特点介绍 - Powered by MinDoc (kunlunbase.com)icon-default.png?t=M666http://www.kunlunbase.com:8181/docs/b/b-1dnl0gmd9l44gKunlun-Storage vs PostgreSQL OLTP 测试 - Powered by MinDoc (kunlunbase.com)icon-default.png?t=M666http://www.kunlunbase.com:8181/docs/b/b-1dq86ad4auj8ePostgreSQL vs MySQL TPC-H 测试 - Powered by MinDoc (kunlunbase.com)icon-default.png?t=M666http://www.kunlunbase.com:8181/docs/b/b-1dp6drao3djef

END

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值