Share via


如何將現有的 Redis 4 快取升級至 Redis 6

Azure Cache for Redis 支援將 Azure Cache for Redis 版本從 Redis 4 升級至 Redis 6。 升級與定期每月維護類似。 升級會遵循與維護相同的模式:首先,會更新複本節點上的 Redis 版本,接著更新主要節點。 用戶端應用程式應該將升級作業確切視為計劃性維護事件。

為了預防此狀況發生,建議您先從現有的 Redis 4 快取匯出資料,並在較低環境中使用 Redis 6 快取測試用戶端應用程式,然後再升級。

如需如何匯出的詳細資訊,請參閱在 Azure Cache for Redis 中匯入與匯出資料

重要

新功能中所公告,我們將於 2023 年 6 月 30 日淘汰 Azure Cache for Redis 執行個體第 4 版。 在該日期之前,您需要將任何快取執行個體升級至第 6 版。

如需 Redis 4 淘汰的詳細資訊,請參閱淘汰常見問題

必要條件

限制

  • 當您在基本層中升級快取時,其會有數分鐘無法使用,並會導致資料遺失。
  • 不支援在異地複寫快取進行升級。 升級前,您必須手動將快取執行個體取消連結。
  • 不支援升級對雲端服務有相依性的快取。 升級前,建議先將快取執行個體移轉至虛擬機器擴展集。
  • 嘗試升級至 Redis 6 時,您的 VNet 必須依照需求進行設定。 若未正確設定,升級可能失敗,或者快取可能在升級後無法正常運作。

檢查快取的版本

在升級前,請在 Azure Cache for Redis 的 [資源] 功能表中選取 [屬性],以檢查快取的 Redis 版本。 建議使用 Redis 6。

Screenshot of properties selected in the Resource menu.

使用 Azure 入口網站升級

  1. 在 Azure 入口網站中,選取您想要從 Redis 4 升級至 Redis 6 的 Azure Cache for Redis 執行個體。

  2. 在畫面左側,選取 [進階設定]

  3. 若您的快取執行個體符合升級資格,您應該會看到以下的藍色橫幅。 若您想要繼續,請選取橫幅中的文字。

    Screenshot informing you that you can upgrade your cache to Redis 6 with more features. Upgrading your cache instance can't be reversed.

  4. 對話方塊會顯示快顯視窗,通知您升級是永久的,而且可能會導致短暫的連線中斷。 若您想要升級快取執行個體,請選取 [是]

    Screenshot showing a dialog with more information about upgrading your cache with Yes selected.

  5. 若要檢查升級的狀態,請瀏覽至 [概觀]

    Screenshot showing Overview in the Resource menu. Status shows cache is being upgraded.

使用 Azure CLI 升級

若要使用未使用私人端點的 Azure CLI 將快取從 4 升級至 6,請使用下列命令。

az redis update --name cacheName --resource-group resourceGroupName --set redisVersion=6

私人端點

如果在快取上啟用私人端點,請根據是否啟用或停用 PublicNetworkAccess 使用適當的命令:

若已啟用 PublicNetworkAccess

 az redis update --name <cacheName> --resource-group <resourceGroupName> --set publicNetworkAccess=Enabled redisVersion=6

若已停用 PublicNetworkAccess

az redis update --name <cacheName> --resource-group <resourceGroupName> --set publicNetworkAccess=Disabled redisVersion=6

使用 PowerShell 升級

若要使用 PowerShell 將快取從 4 升級至 6,請使用下列命令:

Set-AzRedisCache -Name "CacheName" -ResourceGroupName "ResourceGroupName" -RedisVersion "6"

下一步