计划定期备份

安排数据库备份以确保您始终拥有有效的备份。

Redis 企业软件

定期备份提供了一种以最小数据丢失恢复数据的方法。使用 Redis Enterprise Software,您可以将定期备份安排为每天一次(每 24 小时)、每天两次(每 12 小时)、每 4 小时或每小时进行一次。

从 v6.2.8 开始,您可以指定 24 小时或 12 小时备份的 UTC 开始时间。

要进行按需备份,请导出数据

您可以将备份安排到多个位置,包括:

  • FTP 服务器
  • SFTP 服务器
  • 本地挂载点
  • Amazon Simple Storage Service (S3)
  • Azure Blob 存储
  • Google 云存储

备份过程会创建压缩 (.gz) RDB 文件,您可以将这些文件导入到数据库中。如果数据库名称超过 30 个字符,则备份文件名中仅使用前 30 个字符。

备份配置了数据库集群的数据库时, Redis Enterprise Software 为配置中的每个分片创建一个备份文件。所有备份文件都将复制到存储位置。

注意:
  • 确保您的存储位置有足够的可用空间。 如果备份位置中没有足够的空间,则备份将失败。
  • 备份配置仅适用于配置它的数据库。
  • 要限制分片的并行备份,请将tune cluster max_simultaneous_backupstune node max_redis_forks.max_simultaneous_backups默认设置为 4。

计划定期备份

在计划定期备份之前,请验证您的存储位置是否存在,并且可供运行 Redis Enterprise Software (redislabs默认情况下)。您应验证:

  • 权限设置正确。
  • 运行 Redis Enterprise Software 的用户有权访问存储位置。
  • 授权凭证有效。

在计划定期备份之前,会验证存储位置访问权限。

要为数据库计划定期备份,请执行以下作:

  1. 使用管理员凭证登录到 Redis Enterprise Software Cluster Manager UI。

  2. Databases 列表中,选择数据库,然后选择 Configuration

  3. 选择 Edit 按钮。

  4. 展开 Durability (持久性) 部分。

  5. Scheduled backup 部分中,单击 Add backup path 以打开 Path configuration 对话框。

  6. 选择与您的存储位置类型对应的选项卡,输入位置详细信息,然后选择 完成

    有关每种存储位置类型的更多信息,请参阅支持的存储位置

  7. 设置备份 IntervalStart time (开始时间)。

    设置 描述
    间隔 指定备份的频率;即,每个备份快照之间的时间。

    支持的值包括每 24 小时每 12 小时每 4 小时每小时
    开始时间 v6.2.8 或更高版本: 指定备份的开始时间(以 UTC 为单位);当 间隔 设置为 每 24 小时每 12 小时 时可用。

    如果未指定,则默认为 Redis Enterprise Software 选择的时间。
  8. 选择 Save (保存)。

应用更新时,将验证对存储位置的访问。这意味着位置、凭证和其他详细信息必须存在并正常运行,然后才能启用定期备份。

默认备份开始时间

如果您没有指定 24 小时或 12 小时备份的开始时间,Redis Enterprise Software 会为您选择一个以 UTC 为单位的随机开始时间。

此选项假定您的数据库已部署到包含多个数据库的多租户集群。这意味着默认开始时间是交错的(偏移)以确保可用性。这是通过计算随机偏移量来完成的,该偏移量指定添加到开始时间的秒数。

以下是它的工作原理:

  • 假设您在下午 4:00(1600 小时)启用备份。
  • 您选择每 12 小时备份一次数据库。
  • 由于您没有设置开始时间,因此集群会随机选择 4320 秒(或 72 分钟)的偏移量。

这意味着您的第一次定期备份发生在启用定期备份的 72 分钟后(下午 4:00 + 72 分钟)。备份每 12 小时在大致相同的时间重复一次。

备份时间不精确,因为它们是由每 5 分钟运行一次的触发进程启动的。当进程唤醒时,它会将当前时间与计划的备份时间进行比较。如果该时间已过,则会触发备份。

如果上一个备份失败,则触发器进程将重试备份,直到备份成功。

此外,限制和资源限制也会影响备份时间。

有关特定备份问题的帮助,请联系支持人员

支持的存储位置

数据库备份可以保存到本地挂载点,使用 FTP/SFTP 传输到 URI,或存储在云提供商存储上。

当保存到本地挂载点或云提供商时,备份位置需要可供运行 Redis Enterprise Software 的组和用户使用。redislabs:redislabs默认情况下。

Redis Enterprise Software 需要能够查看权限和更新存储位置中的对象。实施详细信息因提供商和您的配置而异。要了解更多信息,请参阅提供商的文档。

以下部分提供了一般准则。由于提供程序功能经常更改,因此请使用提供程序的文档以获取最新信息。

FTP 服务器

在启用到 FTP 服务器的备份之前,请验证:

  • 您的 Redis Enterprise 集群可以连接到 FTP 服务器并进行身份验证。
  • 在 FTP 服务器位置指定的用户具有读取和写入权限。

要将备份存储在 FTP 服务器上,请使用以下语法设置其备份路径

ftp://[username]:[password]@[host]:[port]/[path]/

哪里:

  • protocol:服务器的协议,可以是ftpftps.
  • username:您的用户名(如果需要)。
  • password:您的密码(如果需要)。
  • hostname:服务器的主机名或 IP 地址。
  • port:服务器的端口号(如果需要)。
  • path:备份路径(如果需要)。

例:ftp://username:password@10.1.1.1/home/backups/

用户帐户需要将文件写入服务器的权限。

SFTP 服务器

在启用到 SFTP 服务器的备份之前,请确保:

  • 您的 Redis Enterprise 集群可以连接到 SFTP 服务器并进行身份验证。

  • 在 SFTP 服务器位置指定的用户具有读取和写入权限。

  • SSH 私钥指定正确。您可以使用集群生成的 key,也可以指定自定义 key。

    要使用集群自动生成的密钥:

    1. 转到 Cluster > Security > Certificates

    2. 展开 Cluster SSH Public Key (集群 SSH 公钥)。

    3. 将群集 SSH 公钥下载或复制到 SFTP 服务器上的适当位置。

      使用服务器文档确定 SSH 公钥的适当位置。

要备份到 SFTP 服务器,请输入以下格式的 SFTP 服务器位置:

sftp://user:password@host<:custom_port>/path/

For example: sftp://username:password@10.1.1.1/home/backups/

Local mount point

Before enabling periodic backups to a local mount point, verify that:

  • The node can connect to the destination server, the one hosting the mount point.
  • The redislabs:redislabs user has read and write privileges on the local mount point and on the destination server.
  • The backup location has enough disk space for your backup files. Backup files are saved with filenames that include the timestamp, which means that earlier backups are not overwritten.

To back up to a local mount point:

  1. On each node in the cluster, create the mount point:

    1. Connect to a shell running on Redis Enterprise Software server hosting the node.

    2. Mount the remote storage to a local mount point.

      For example:

      sudo mount -t nfs 192.168.10.204:/DataVolume/Public /mnt/Public
      
  2. In the path for the backup location, enter the mount point.

    For example: /mnt/Public

  3. Verify that the user running Redis Enterprise Software has permissions to access and update files in the mount location.

AWS Simple Storage Service

To store backups in an Amazon Web Services (AWS) Simple Storage Service (S3) bucket:

  1. Sign in to the AWS Management Console.

  2. Create an S3 bucket if you do not already have one.

  3. Create an IAM User with permission to add objects to the bucket.

  4. Create an access key for that user if you do not already have one.

  5. In the Redis Enterprise Software Cluster Manager UI, when you enter the backup location details:

    • Select the AWS S3 tab on the Path configuration dialog.

    • In the Path field, enter the path of your bucket.

    • In the Access Key ID field, enter the access key ID.

    • In the Secret Access Key field, enter the secret access key.

You can also connect to a storage service that uses the S3 protocol but is not hosted by Amazon AWS. The storage service must have a valid SSL certificate. To connect to an S3-compatible storage location, run rladmin cluster config:

rladmin cluster config s3_url <URL>

Replace <URL> with the hostname or IP address of the S3-compatible storage location.

Google Cloud Storage

For Google Cloud subscriptions, store your backups in a Google Cloud Storage bucket:

  1. Sign in to the Google Cloud Platform console.

  2. Create a JSON service account key if you do not already have one.

  3. Create a bucket if you do not already have one.

  4. Add a principal to your bucket:

    • In the New principals field, add the client_email from the service account key.

    • Select "Storage Legacy Bucket Writer" from the Role list.

  5. In the Redis Enterprise Software Cluster Manager UI, when you enter the backup location details:

    • Select the Google Cloud Storage tab on the Path configuration dialog.

    • In the Path field, enter the path of your bucket.

    • In the Client ID field, enter the client_id from the service account key.

    • In the Client Email field, enter the client_email from the service account key.

    • In the Private Key ID field, enter the private_key_id from the service account key.

    • In the Private Key field, enter the private_key from the service account key. Replace \n with new lines.

Azure Blob Storage

To store your backup in Microsoft Azure Blob Storage, sign in to the Azure portal and then:

To export to Microsoft Azure Blob Storage, sign in to the Azure portal and then:

  1. Create an Azure Storage account if you do not already have one.

  2. Create a container if you do not already have one.

  3. Manage storage account access keys to find the storage account name and account keys.

  4. In the Redis Enterprise Software Cluster Manager UI, when you enter the backup location details:

    • Select the Azure Blob Storage tab on the Path configuration dialog.

    • In the Path field, enter the path of your bucket.

    • In the Azure Account Name field, enter your storage account name.

    • In the Azure Account Key field, enter the storage account key.

To learn more, see Authorizing access to data in Azure Storage.

RATE THIS PAGE
Back to top ↑