調度叢集容量

本頁面說明如何在 Memorystore for Redis Cluster 擴充叢集。叢集的容量取決於叢集中的 shard 數量和叢集的節點類型。如要調度叢集資源,請變更 shard 數量或節點類型。如要進一步瞭解叢集在資源調度期間的行為,請參閱「關於調整叢集容量」。

資源調度與雙可用區部署

如果透過新增 shard 或副本來擴充叢集時,可用區資源不足,Memorystore for Redis Cluster 會自動將叢集部署至兩個可用區。這項部署作業可確保叢集成功擴充。如要進一步瞭解這類部署作業,請參閱「雙可用區部署作業,可提供高可用性和彈性」。

調整 shard 數量

您可以使用 Google Cloud 控制台或 Google Cloud CLI,增加或減少叢集的 shard 數量。

控制台

  1. 在 Google Cloud 控制台中,前往「Memorystore for Redis Cluster」頁面。

    Memorystore for Redis Cluster

  2. 按一下叢集 ID。

  3. 在「Configurations」(設定) 區段中,按一下「Shards」(Shard) 旁的鉛筆圖示。

  4. 在「Shards」(Shard) 欄位中,輸入要將叢集擴充至多少個 shard。

  5. 按一下「Update cluster」(更新叢集)。

gcloud

如要調整叢集的 shard 數量,請使用 gcloud redis clusters update 指令:

gcloud redis clusters update CLUSTER_ID \
--region=REGION_ID \
--shard-count=SHARD_COUNT

更改下列內容:

  • CLUSTER_ID:叢集 ID。
  • REGION_ID:叢集所在的區域。
  • SHARD_COUNT:叢集中的 shard 數量。shard 數量會決定儲存叢集資料的總記憶體容量。如要進一步瞭解叢集的叢集和節點規格,請參閱「叢集和節點規格」。

例如:

gcloud redis clusters update my-cluster \
--region=us-central1 \
--shard-count=8

調整節點類型

您可以使用 Google Cloud CLI 調整叢集的節點類型。

gcloud

  1. 如要擷取叢集相關資訊,請使用 gcloud redis clusters describe 指令:

    gcloud redis clusters describe CLUSTER_ID \
    --region=REGION_ID
    

    更改下列內容:

    • CLUSTER_ID:叢集 ID
    • REGION_ID:叢集所在的區域 (例如 us-central1)
  2. 檢查輸出內容,確認是否符合下列條件:

    1. 輸出內容包含 redisConfigs 部分。

    2. maxmemory-clients、maxmemory 或 maxclients 參數會顯示在這個部分。

    如果出現上述任何參數,當您縮放叢集的節點類型時,必須縮放參數值,以反映 Memorystore for Redis Cluster 可接受的縮放後節點類型值。詳情請參閱「可修改的設定參數」。

  3. 如要調度節點類型,請使用 gcloud redis clusters update 指令:

    gcloud redis clusters update CLUSTER_ID \
    --region=REGION_ID \
    --node-type=NODE_TYPE
    

    更改下列內容:

    • CLUSTER_ID:叢集 ID
    • REGION_ID:叢集所在的區域
    • NODE_TYPE:要將叢集擴充至的節點類型

    在本例中,您會將 my-cluster 叢集的節點類型調度為 redis-highmem-medium。這個叢集位於 us-central1 區域。

    gcloud redis clusters update my-cluster \
    --region=us-central1 \
    --node-type=redis-highmem-medium
    

    在本範例中,請將 maxclients 參數的值變更為 15,000。

    gcloud redis clusters update my-cluster \
    --region=us-central1 \
    --node-type=redis-highmem-medium \
    --update-redis-config=maxclients=15000