註冊可擴展的目標 - Amazon ElastiCache (雷迪OSS斯)

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

註冊可擴展的目標

在您可以將 Auto Scaling 與 ElastiCache (Redis OSS) 叢集搭配使用之前,請先使用 ElastiCache (Redis OSS) 自動調整規模來註冊叢集。您這樣做是為了定義要套用至該叢集的擴展維度和限制。 ElastiCache (Redis OSS) auto 縮放動態縮放 ElastiCache (Redis OSS) 叢集沿著elasticache:replication-group:NodeGroups可擴充維度,表示叢集碎片的數量。

使用 AWS CLI

若要註冊 ElastiCache (Redis OSS) 叢集,請使用具有下列參數的register-scalable-target命令:

  • --service-namespace – 將此值設定為 elasticache

  • --resource-id— ElastiCache (Redis OSS) 叢集的資源識別碼。對於這個參數,資源類型是ReplicationGroup,唯一識別碼是 ElastiCache (Redis OSS) 叢集的名稱,例如。replication-group/myscalablecluster

  • --scalable-dimension – 將此值設定為 elasticache:replication-group:NodeGroups

  • --max-capacity — 要由 ElastiCache (Redis OSS) auto 縮放管理的最大碎片數量。如需了解有關 --min-capacity--max-capacity 以及叢集中碎片數目之間的關係資訊,請參閱「容量下限和上限」。

  • --min-capacity — 要由 ElastiCache (Redis OSS) auto 縮放管理的最小碎片數量。如需了解有關 --min-capacity--max-capacity 以及叢集中碎片數目之間的關係資訊,請參閱「容量下限和上限」。

在下列範例中,您註冊名為的 ElastiCache (Redis OSS) 叢集。myscalablecluster註冊中表明應該動態擴展叢集,使其具有 1 到 10 個碎片。

若為 Linux、macOS 或 Unix:

aws application-autoscaling register-scalable-target \ --service-namespace elasticache \ --resource-id replication-group/myscalablecluster \ --scalable-dimension elasticache:replication-group:NodeGroups \ --min-capacity 1 \ --max-capacity 10 \

針對 Windows:

aws application-autoscaling register-scalable-target ^ --service-namespace elasticache ^ --resource-id replication-group/myscalablecluster ^ --scalable-dimension elasticache:replication-group:NodeGroups ^ --min-capacity 1 ^ --max-capacity 10 ^

使用 API

若要註冊 ElastiCache 叢集,請使用具有下列參數的register-scalable-target命令:

  • ServiceNamespace — 將此值設置為彈性疼。

  • ResourceID — 叢集的資源識別碼。 ElastiCache 對於這個參數,資源類型是 ReplicationGroup ,唯一識別碼是 ElastiCache (Redis OSS) 叢集的名稱,例如。replication-group/myscalablecluster

  • ScalableDimension — 將此值設定為elasticache:replication-group:NodeGroups

  • MinCapacity — 要由 ElastiCache (Redis OSS) auto 縮放管理的最小碎片數量。如需了解 --min-capacity、--max-capacity 以及叢集中複本數之間的關係,請參閱「容量下限和上限」。

  • MaxCapacity — 要由 ElastiCache (Redis OSS) auto 縮放管理的最大碎片數量。如需了解 --min-capacity、--max-capacity 以及叢集中複本數之間的關係,請參閱「容量下限和上限」。

在下列範例中,您註冊名為 myscalablecluster Application Auto Scaling API 的 ElastiCache (Redis OSS) 叢集。此註冊中表明應該動態擴展叢集,使其具有 1 到 5 個複本。

POST / HTTP/1.1 Host: autoscaling.us-east-2.amazonaws.com Accept-Encoding: identity Content-Length: 219 X-Amz-Target: AnyScaleFrontendService.RegisterScalableTarget X-Amz-Date: 20160506T182145Z User-Agent: aws-cli/1.10.23 Python/2.7.11 Darwin/15.4.0 botocore/1.4.8 Content-Type: application/x-amz-json-1.1 Authorization: AUTHPARAMS { "ServiceNamespace": "elasticache", "ResourceId": "replication-group/myscalablecluster", "ScalableDimension": "elasticache:replication-group:NodeGroups", "MinCapacity": 1, "MaxCapacity": 5 }