Azure Cache for Redis 的高可用性High availability for Azure Cache for Redis

Azure Cache for Redis 具有内置的高可用性。Azure Cache for Redis has built-in high availability. 其高可用性体系结构的目标是确保托管的 Redis 实例正常运行,即使其基础虚拟机 (VM) 受计划内或计划外中断的影响。The goal of its high availability architecture is to ensure that your managed Redis instance is functioning even when its underlying virtual machines (VMs) are impacted by planned or unplanned outages. 它提供的可用性百分比率要远高于将 Redis 承载在单个 VM 上的情况。It delivers much greater percentage rates than what's attainable by hosting Redis on a single VM.

Azure Cache for Redis 使用多个称为“节点”的用于缓存的 VM 来实现高可用性。Azure Cache for Redis implements high availability by using multiple VMs, called nodes, for a cache. 它将这些节点配置为以协调的方式进行数据复制和故障转移。It configures these nodes such that data replication and failover happen in coordinated manners. 它还会协调维护操作,例如 Redis 软件修补。It also orchestrates maintenance operations such as Redis software patching. “标准”、“高级”和“企业”层级中提供了各种高可用性选项:Various high availability options are available in the Standard, Premium, and Enterprise tiers:

选项Option 说明Description 可用性Availability 标准Standard 高级Premium EnterpriseEnterprise
标准复制Standard replication 单个数据中心或可用性区域 (AZ) 中具有自动故障转移功能的双节点复制配置Dual-node replicated configuration in a single datacenter or availability zone (AZ), with automatic failover 99.9%99.9% -
Enterprise 群集Enterprise cluster 链接了两个区域中的缓存实例,提供自动故障转移Linked cache instances in two regions, with automatic failover 99.9%99.9% - -
异地复制Geo-replication 两个区域中的链接缓存实例,具有用户控制的故障转移Linked cache instances in two regions, with user-controlled failover 99.9%(对于单个区域)99.9% (for a single region) - -

标准复制Standard replication

默认情况下,在“标准”或“高级”层级中,Azure Cache for Redis 在一对 Redis 服务器上运行。An Azure Cache for Redis in the Standard or Premium tier runs on a pair of Redis servers by default. 这两个服务器托管在专用 VM 上。The two servers are hosted on dedicated VMs. 开源 Redis 只允许一台服务器处理数据写入请求。Open-source Redis allows only one server to handle data write requests. 此服务器是主要节点,而另一服务器是副本。This server is the primary node, while the other replica. 预配服务器节点后,Azure Cache for Redis 可向其分配主要角色和副本角色。After it provisions the server nodes, Azure Cache for Redis assigns primary and replica roles to them. 主要节点通常负责为来自 Redis 客户端的写入和读取请求提供服务。The primary node usually is responsible for servicing write as well as read requests from Redis clients. 在执行写入操作时,它会向其内部内存提交一个新密钥和密钥更新,并立即回复客户端。On a write operation, it commits a new key and a key update to its internal memory and replies immediately to the client. 它以异步方式将操作转发给副本。It forwards the operation to the replica asynchronously.

数据复制设置

备注

通常,Redis 客户端会与 Redis 缓存中的主节点通信,以获取所有读取和写入请求。Normally, a Redis client communicates with the primary node in a Redis cache for all read and write requests. 某些 Redis 客户端可以配置为从副本节点进行读取。Certain Redis clients can be configured to read from the replica node.

如果 Redis 缓存中的主节点不可用,则副本会自动升级为新的主节点。If the primary node in a Redis cache is unavailable, the replica will promote itself to become the new primary automatically. 此过程称为故障转移。This process is called a failover. 副本会等待足够长的时间才去接管,以免出现主节点快速恢复的情况。The replica will wait for sufficiently long time before taking over in case that the primary node recovers quickly. 发生故障转移时,Azure Cache for Redis 会预配新的 VM,并将其作为副本节点加入到缓存中。When a failover happens, Azure Cache for Redis provisions a new VM and joins it to the cache as the replica node. 副本执行与主节点的完整数据同步,这样它就会有缓存数据的另一个副本。The replica performs a full data synchronization with the primary so that it has another copy of the cache data.

主节点在计划内维护活动(例如 Redis 软件或操作系统更新)中可能会停止服务。A primary node can go out of service as part of a planned maintenance activity such as Redis software or operating system update. 它还可能因为计划外事件(例如底层硬件、软件或网络故障)而停止工作。It also can stop working because of unplanned events such as failures in underlying hardware, software, or network. Azure Cache for Redis 的故障转移和修补提供了有关 Redis 故障转移类型的详细说明。Failover and patching for Azure Cache for Redis provides a detailed explanation on types of Redis failovers. Azure Cache for Redis 在其生存期内会经历许多故障转移。An Azure Cache for Redis will go through many failovers during its lifetime. 高可用性体系结构旨在使缓存中的这些更改对其客户端尽可能透明。The high availability architecture is designed to make these changes inside a cache as transparent to its clients as possible.

备注

以下内容以预览版提供。The following is available as a preview.

此外,Azure Cache for Redis 在高级层中允许更多副本节点。In addition, Azure Cache for Redis allows additional replica nodes in the Premium tier. 可以为多副本缓存配置最多三个副本节点。A multi-replica cache can be configured with up to three replica nodes. 具有更多副本通常会提高复原能力,因为附加的节点会为主节点提供备份。Having more replicas generally improves resiliency because of the additional nodes backing up the primary. 即使有更多副本,Azure Cache for Redis 实例仍可能会受到数据中心范围的或 AZ 范围的服务中断的严重影响。Even with more replicas, an Azure Cache for Redis instance still can be severely impacted by a datacenter- or AZ-wide outage. 通过将多个副本与区域冗余结合使用,可以提高缓存可用性。You can increase cache availability by using multiple replicas in conjunction with zone redundancy.

Enterprise 群集Enterprise cluster

备注

此功能以预览版提供。This is available as a preview.

任一企业层中的缓存在 Redis Enterprise 群集上运行。A cache in either Enterprise tier runs on a Redis Enterprise cluster. 它需要在任何时候都保持奇数个服务器节点以便形成仲裁。It requires an odd number of server nodes at all times to form a quorum. 默认情况下,它由三个节点组成,每个节点都托管在专用 VM 上。By default, it's comprised of three nodes, each hosted on a dedicated VM. Enterprise 缓存有两个大小相同的数据节点和一个较小的仲裁节点 。An Enterprise cache has two same-sized data nodes and one smaller quorum node. Enterprise Flash 缓存有三个大小相同的数据节点。An Enterprise Flash cache has three same-sized data nodes. Enterprise 群集在内部将 Redis 数据划分为多个分区。The Enterprise cluster divides Redis data into partitions internally. 每个分区有一个主分区和至少一个副本 。Each partition has a primary and at least one replica. 每个数据节点都包含一个或多个分区。Each data node holds one or more partitions. Enterprise 群集可确保任何分区的主分区和副本永远不会并置在同一数据节点上。The Enterprise cluster ensures that the primary and replica(s) of any partition are never colocated on the same data node. 分区将数据从主分区异步复制到其相应的副本。Partitions replicate data asynchronously from primaries to their corresponding replicas.

当数据节点不可用或发生网络拆分时,会发生类似于标准复制中描述的故障转移。When a data node becomes unavailable or a network split happens, a failover similar to the one described in Standard replication takes place. Enterprise 群集使用基于仲裁的模型来确定哪些未受影响的节点将参与新的仲裁。The Enterprise cluster uses a quorum-based model to determine which surviving nodes will participate in a new quorum. 它还根据需要将这些节点中的分区副本提升为主分区。It also promotes replica partitions within these nodes to primaries as needed.

异地复制Geo-replication

异地复制主要是为灾难恢复设计的。Geo-replication is designed mainly for disaster recovery. 它使你能够在另一 Azure 区域中配置 Azure Cache for Redis 实例,以便为主缓存提供备份。It gives you the ability to configure an Azure Cache for Redis instance, in a different Azure region, to back up your primary cache. 为 Azure Cache for Redis 设置异地复制提供了有关异地复制工作原理的详细说明。Set up geo-replication for Azure Cache for Redis gives a detailed explanation on how geo-replication works.

后续步骤Next steps

详细了解如何配置 Azure Cache for Redis 高可用性选项。Learn more about how to configure Azure Cache for Redis high-availability options.