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. 它提供的百分比比在單一 VM 上裝載 Redis 可達成的速率高出許多。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 PremiumPremium EnterpriseEnterprise
標準複寫Standard replication 具有自動容錯移轉之單一資料中心內的雙重節點複寫設定Dual-node replicated configuration in a single datacenter with automatic failover 99.9% (請參閱 詳細資料) 99.9% (see details) -
區域備援Zone redundancy 跨 Az 的多重節點複寫設定,具有自動容錯移轉Multi-node replicated configuration across AZs, with automatic failover 最多 99.99% (查看 詳細資料) Up to 99.99% (see details) - 預覽Preview 預覽Preview
異地複寫Geo-replication 兩個區域中的連結快取實例,具有使用者控制的容錯移轉Linked cache instances in two regions, with user-controlled failover 最多 99.999% (查看 詳細資料) Up to 99.999% (see details) - 預覽Preview

標準複寫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-level outage. 您可以使用多個複本搭配 區域冗余來提高快取可用性。You can increase cache availability by using multiple replicas in conjunction with zone redundancy.

區域備援Zone redundancy

Azure Cache for Redis 支援 Premium 和 Enterprise 層中的區域多餘設定。Azure Cache for Redis supports zone redundant configurations in the Premium and Enterprise tiers. 區域冗余快取可將其節點放在相同區域中的不同Azure 可用性區域A zone redundant cache can place its nodes across different Azure Availability Zones in the same region. 它會將資料中心或 AZ 中斷排除為單一失敗點,並提高快取的整體可用性。It eliminates datacenter or AZ outage as a single point of failure and increases the overall availability of your cache.

進階層Premium tier

注意

這會以預覽形式提供。This is available as a preview.

下圖說明進階層的區域多餘設定:The following diagram illustrates the zone redundant configuration for the Premium tier:

區域冗余設定

Azure Cache for Redis 會透過您所選取的 Az,以迴圈配置資源的方式,在區域冗余快取中分散節點。Azure Cache for Redis distributes nodes in a zone redundant cache in a round-robin manner over the AZs you've selected. 它也會決定哪一個節點一開始做為主要節點。It also determines which node will serve as the primary initially.

區域冗余快取會提供自動容錯移轉。A zone redundant cache provides automatic failover. 當目前的主要節點無法使用時,其中一個複本將會接管。When the current primary node is unavailable, one of the replicas will take over. 如果新的主要節點位於不同的 AZ 中,則您的應用程式可能會遇到較高的快取回應時間。Your application may experience higher cache response time if the new primary node is located in a different AZ. Az 是以地理區隔開。AZs are geographically separated. 從一個 AZ 切換到另一個 AZ,改變了您的應用程式和快取裝載位置之間的實體距離。Switching from one AZ to another alters the physical distance between where your application and cache are hosted. 此變更會影響您應用程式到快取的來回網路延遲。This change impacts round-trip network latencies from your application to the cache. 額外的延遲預期會落在大部分應用程式可接受的範圍內。The extra latency is expected to fall within an acceptable range for most applications. 建議您測試應用程式,以確保它可以透過區域冗余快取順利執行。We recommend that you test your application to ensure that it can perform well with a zone-redundant cache.

企業層級Enterprise tiers

任一企業層中的快取都是在 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. 企業快取有兩個相同大小的 資料節點 和一個較小的 仲裁節點An Enterprise cache has two same-sized data nodes and one smaller quorum node. 企業 Flash 快取有三個相同大小的資料節點。An Enterprise Flash cache has three same-sized data nodes. 企業叢集會將 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. 企業叢集可確保任何資料分割的主要和複本 (的) 都不會共置於相同的資料節點上。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. 企業叢集使用以仲裁為基礎的模型,來判斷哪些存活的節點將參與新的仲裁。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

異地 複寫是一種機制,可連結兩個或多個 Azure Cache for Redis 實例,通常跨越兩個 Azure 區域。Geo-replication is a mechanism for linking two or more Azure Cache for Redis instances, typically spanning two Azure regions.

進階層Premium tier

注意

進階層中的異地複寫主要是為了災難復原而設計的。Geo-replication in the Premium tier is designed mainly for disaster recovery.

您可以透過 異地 複寫來連接兩個進階層快取實例,讓您可以將快取資料備份至不同的區域。Two Premium tier cache instances can be connected through geo-replication so that you can back up your cache data to a different region. 一旦連結在一起,就會將某個實例指定為主要連結快取,而另一個實例則指定為次要連結快取。Once linked together, one instance is designated as the primary linked cache and the other as the secondary linked cache. 只有主要快取會接受讀取和寫入要求。Only the primary cache accepts read and write requests. 寫入至主要快取的資料會複寫到次要快取。Data written to the primary cache is replicated to the secondary cache. 應用程式會透過不同的端點來存取主要和次要快取的快取。An application access the cache through separate endpoints for the primary and secondary caches. 當應用程式部署到多個 Azure 區域時,應用程式必須將所有寫入要求傳送到主要快取。The application must send all write requests to the primary cache when it's deployed in multiple Azure regions. 它可以從主要或次要快取讀取。It can read from either the primary or secondary cache. 一般而言,您會想要讓應用程式的計算實例從最接近的快取讀取,以降低延遲。In general, you want to your application's compute instances to read from the closest caches to reduce latency. 這兩個快取實例之間的資料傳輸是由 TLS 保護。Data transfer between the two cache instances is secured by TLS.

如果您的應用程式其餘部分保留在主要區域中,則異地複寫不會提供自動容錯移轉,因為這會在區域之間增加網路往返時間的考慮。Geo-replication doesn't provide automatic failover due to concerns over added network roundtrip time between regions if the rest of your application remains in the primary region. 您必須取消連結次要快取,以管理和起始容錯移轉。You'll need to manage and initiate the failover by unlinking the secondary cache. 這會將它升階為新的主要實例。This will promote it to be the new primary instance.

企業層級Enterprise tiers

注意

這會以預覽形式提供。This is available as a preview.

企業層支援更先進的異地複寫形式,稱為「 主動式異地複寫」。The Enterprise tiers support a more advanced form of geo-replication, called active geo-replication. 利用無衝突的複寫資料類型,Redis Enterprise 軟體支援寫入至多個快取實例,並視需要處理變更並解決衝突。Leveraging conflict-free replicated data types, the Redis Enterprise software supports writes to multiple cache instances and takes care of merging of changes and resolving conflicts if necessary. 您可以聯結不同 Azure 區域中的兩個或多個企業層快取實例,以形成主動式異地複寫快取。Two or more Enterprise tier cache instances in different Azure regions can be joined to form an active geo-replicated cache. 使用這類快取的應用程式可以透過對應的端點來讀取和寫入異地分散式快取實例。An application using such a cache can read and write to the geo-distributed cache instances through corresponding endpoints. 它應該使用最接近每個計算實例的內容,以提供最低延遲。It should use what is the closest to each compute instance, which gives the lowest latency. 如果其中一個實例變成無法使用,應用程式也需要監視快取實例,並切換到另一個區域。The application also needs to monitor the cache instances and switch to another region if one of the instances becomes unavailable. 如需主動式異地複寫運作方式的詳細資訊,請參閱 主動-主動 Geo-Distriubtion (crdt 為基礎的) For more information on how active geo-replication works, see Active-Active Geo-Distriubtion (CRDTs-Based).

下一步Next steps

深入瞭解如何設定 Azure Cache for Redis 高可用性選項。Learn more about how to configure Azure Cache for Redis high-availability options.