使用全局数据存储 (CLI) - Amazon ElastiCache
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

使用全局数据存储 (CLI)

您可以使用 AWS Command Line Interface (AWS CLI) 从命令行管理多个 AWS 服务并通过脚本自动执行这些服务。您可以使用 AWS CLI 进行临时(一次性)操作。

下载和配置 AWS CLI

AWS CLI 在 Windows、macOS 或 Linux 上运行。按照以下步骤下载和并对其进行配置。

下载、安装和配置 CLI

  1. AWS 命令行界面网页上下载 AWS CLI。

  2. 按照 AWS Command Line Interface 用户指南 中的说明安装 AWS CLI 和配置 AWS CLI。

将 AWS CLI 与全局数据存储结合使用

使用以下 CLI 操作来处理全局数据存储:

  • create-global-replication-group

    aws elasticache create-global-replication-group \ --global-replication-group-id-suffix my global datastore \ --primary-replication-group-id sample-repl-group \ --global-replication-group-description an optional description of the global datastore
  • create-replication-group – 使用此操作可通过向 --global-replication-group-id 参数提供全局数据存储的名称来创建全局数据存储的辅助集群。

    aws elastiche create-replication-group \ --replication-group-id secondary replication group name \ --replication-group-description “Replication group description" \ --global-replication-group-id global datastore name \
  • describe-global-replication-groups

    aws elasticache describe-global-replication-groups \ --global-replication-group-id my global datastore \ --show-member-info an optional parameter that returns a list of the primary and secondary clusters that make up the global datastore
  • modify-global-replication-group

    aws elasticache modify-global-replication-group \ --global-replication-group-id my global datastore \ --automatic-failover-enabled yes/no --cache-node-type node type --engine-version engine version -—apply-immediately --global-replication-group-description description
  • delete-global-replication-group

    aws elasticache delete-global-replication-group \ --global-replication-group-id my global datastore \ --retain-primary-replication-group defaults to true
  • disassociate-global-replication-group

    aws elasticache disassociate-global-replication-group \ --global-replication-group-id my Global Datastore \ --replication-group-id my secondary cluster \ --replication-group-region the AWS Region in which the secondary cluster resides
  • failover-global-replication-group

    aws elasticache failover-replication-group \ --global-replication-group-id my global datastore \ --primary-region The AWS Region of the primary cluster \ --primary-replication-group-id The name of the global datastore, including the suffix.
  • increase-node-groups-in-global-replication-group

    aws elasticache increase-node-groups-in-global-replication-group \ --apply-immediately yes\ --global-replication-group-id global-replication-group-name \ --node-group-count 3
  • decrease-node-groups-in-global-replication-group

    aws elasticache decrease-node-groups-in-global-replication-group \ --apply-immediately yes\ --global-replication-group-id global-replication-group-name \ --node-group-count 3
  • rebalance-shards-in-global-replication-group

    aws elasticache rebalance-shards-in-global-replication-group \ --apply-immediately yes\ --global-replication-group-id global-replication-group-name \

使用帮助列出所有可用命令 ElastiCache for Redis。

aws elasticache help

您还可以使用帮助来描述特定命令并了解有关其用法的详细信息:

aws elasticache create-global-replication-group help