aerospike备份与恢复概述
所属分类 aerospike
浏览量 1793
根据原文翻译整理
https://www.aerospike.com/docs/tools/backup/index.html
Aerospike provides the ability to backup and restore your cluster data.
Under normal circumstances, data replication (within a cluster) and cross data center replication (XDR)
ensure that data is not lost even when there are hardware failures or network outages.
However, it is good practice to periodically create backups for easier recovery from catastrophic data center failures or administrative accidents.
Aerospike提供了备份和恢复集群数据的能力。
在正常情况下,数据复制(在集群内)和跨数据中心复制(XDR)确保数据不丢失,即使出现硬件故障或网络中断。
但是最好定期创建备份,以便从灾难性数据中心故障或管理事故中更容易地恢复。
The backup/restore utilities available are:
asbackup - Backup all data from a namespace or a specific set in the namespace using Aerospike's standard client scan API.
asrestore - Restore namespace or set data from a backup created by asbackup using Aerospike's standard client API.
The backup/restore utilities are part of the aerospike-tools installation package, and is also source code available on github.
https://github.com/aerospike/aerospike-tools-backup
备份/还原工具
asbackup 使用Aerospike标准客户端扫描API从名称空间或名称空间中的特定set备份所有数据。
asrestore 使用Aerospike标准客户端API从 asbackup 创建的备份中还原名称空间或set数据。
备份/恢复工具 aerospike-tools 安装包的一部分,github 源代码
What Data is Backed Up
You have the option of backing up:
Records
Record metadata (digest, TTL, generation count, key)
Regular bins (string, integer, binary)
Complex data type (CDT) bins (list, map)
Secondary index definitions
User defined function (UDF) modules
可选的备份数据
记录
记录元数据 (摘要 TTL 更新次数 key)
常规列 (字符串 整数 二进制)
复制数据类型列 (列表 map)
二级索引定义
UDF模块
Incremental Backup
Starting from Server and Tools version 3.12, timestamp can be specified when initiating a backup to indicate the time-period of interest.
Only records whose last-update-time satisfies the specified criteria (before time T1 and/or after time T2) will be backed up.
增量备份
3.12版本之后,可指定时间戳
只备份 last-update-time (LUT) 早于 晚于 指定时间点数据
How the Backup Files are Created
Backup files are human-readable text files.
For details, see the File Format Specification in the source code repository.
https://github.com/aerospike/aerospike-tools-backup/tree/master#backup-file-format
备份文件是 可读的 文本文件
The most basic form of running asbackup is to just specify the cluster to backup (--host), the namespace to backup (--namespace),
as well as the local directory for the backup files (--directory). Suppose that we have a cluster that contains a node with IP address 1.2.3.4.
To backup the test namespace on this cluster to the directory backup_2015_08_24, we would issue the following command.
$ asbackup --host 1.2.3.4 --namespace test --directory backup_2015_08_24
host 需要备份的 as集群
namespace 需要备份的 namespace
directory 备份文件存储目录
The backup program asbackup reads records from the cluster to be backed up
and stores them in a set of backup files under the directory specified with the --directory command line option.
By default, each backup file is limited to 250 MiB. When this limit is crossed, asbackup starts a new file.
Alternatively, the cluster can be backed up to a single file or to stdout using --output-file instead of --directory.
备份文件默认大小 250M , 超过大小会新建一个文件
如果要备份成单个文件 使用 output-file 参数 代替 directory
The --no-cluster-change option aborts the backup, if a cluster node fails during the backup.
Node failures cause the cluster to rebalance and, thus, data migration between nodes.
In case the backup is aborted, please restart it after data migration is complete.
如果集群节点在备份期间发生故障,使用 no-cluster-change选项将中止备份。
节点故障导致集群重新平衡,从而导致节点之间的数据迁移。如果备份被中止,请在数据迁移完成后重新启动备份。
If the backup is aborted, the backup files created up to that point will remain around,
and by default, asbackup will refuse to overwrite existing backup files.
When restarting the backup, you may either backup to a different directory or file,
or use --remove-files to have asbackup remove the existing backup file or files.
如果备份被中止,在此之前创建的备份文件将继续存在,默认情况下,asbackup将拒绝覆盖现有的备份文件。
当重新启动备份时,可以备份到另一个目录或文件,或使用 remove-files 选项 删除现有的备份文件。
How the Data is Restored
Backups are cluster-agnostic.
The size and configuration of the cluster from which the backup was taken can be completely different from the size and configuration of the cluster to which the data is restored.
Data backed up from a 5-node cluster, for example, can be restored to a 4-node or 7-node cluster.
The restore process will always evenly distribute the data across the cluster nodes.
备份集群无关 ,备份和恢复是的集群节点数可以不同
The most basic form of running asrestore is to just specify the cluster to restore (--host) and the local directory containing the backup files (--directory).
Suppose that we have a cluster that contains a node with IP address 1.2.3.4.
To restore a backup from directory backup_2015_08_24, we would issue the following command.
$ asrestore --host 1.2.3.4 --directory backup_2015_08_24
host 集群ip
directory 备份文件存储目录
By default, the backup is restored to the namespace that it was taken from.
The --namespace option can be used to restore to a different namespace.
Suppose that the above backup was taken from namespace test and we would like to restore it to namespace prod.
We would then issue the following command.
$ asrestore --host 1.2.3.4 --directory backup_2015_08_24 --namespace test,prod
namespace 设置备份与恢复的namespace ,不设置代表一致
asrestore reads backup files from the directory specified with the --directory option.
Alternatively, if the backup consists of a single file created with the --output-file option of asbackup,
the --input-file option can be used to make asrestore read that single file or stdin.
如果使用 output-file 备份 ,则使用 input-file 恢复数据
Restored records preserve the record's original TTL. Last-update-time and generation will be new.
恢复的记录时,保留了原始的 TTL , LUT与更新次数会变成新的
The Write Policy
The read data is restored to a namespace in a cluster using the standard client API for storing records.
The namespace may already contain existing records and, by default, the write policy works as follows.
If the record from the backup is expired (based on its TTL value), it is ignored.
If the record does not exist in the namespace, it is restored from the backup.
If a newer version of the record (higher or same generation count) exists in the namespace, the record from the backup is ignored.
If an older version of the record (lower generation count) exists in the namespace, the record is restored from the backup.
If the record in the namespace contains bins that are not present in the backup, those bins are preserved.
写入策略
备份记录已过期,忽略
记录不存在,则写入
记录版本或更新次数 >= 备份记录,忽略
如果名称空间中存在较老版本的记录(较小的更新次数),则从备份中恢复该记录。如果名称空间中的记录包含备份中不存在的桶,则保留这些桶。
The following asrestore command line options modify this write policy.
--unique - Do not touch any existing records, regardless of generation counts.
--no-generation - Overwrite any existing records, regardless of generation counts.
--replace - When restoring a record from the backup, do not preserve bins that are not present in the backup.
写入策略参数
unique 不恢复任何存在的记录
no-generation 恢复任何存在的记录,忽略版本
replace 恢复记录时,不保留备份记录不存在的列
asrestore will only restore backups that are Version 3.0 or higher. To restore a backups from Version 2.0 to Version 3.0 please contact Aerospike Support.
3.0及以上版本才支持 备份与恢复
上一篇
下一篇
这样的人你敢要吗
我们怎么了
做局与破局
aerospike备份
aerospike恢复
客户的游艇在哪里摘录