

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Global Datastore の使用 (CLI)
<a name="Redis-Global-Datastores-CLI"></a>

 AWS Command Line Interface (AWS CLI) を使用して、コマンドラインから複数の AWS サービスを制御し、スクリプトを使用して自動化できます。CLI AWS は、アドホック (1 回限り) オペレーションに使用できます。

## のダウンロードと設定 AWS CLI
<a name="Redis-Global-Datastores-Downloading-CLI"></a>

は Windows、macOS、または Linux で AWS CLI 実行されます。これをダウンロードして設定するには、次の手順に従います。

**CLI をダウンロード、インストール、設定するには**

1. [AWS コマンドラインインターフェイス](https://aws.amazon.com/cli)ウェブページで AWS CLI をダウンロードします。

1. 「 *AWS Command Line Interface ユーザーガイド*」の AWS 「 CLI のインストール」および AWS 「 CLI の設定」の手順に従います。

## グローバルデータストアでの AWS CLI の使用
<a name="Redis-Global-Datastores-Using-CLI"></a>

Global Datastore を操作するには、次の CLI オペレーションを使用します。
+ [create-global-replication-group](https://docs.aws.amazon.com/cli/latest/reference/elasticache/create-global-replication-group.html)

  ```
  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 }}
  ```

  Amazon ElastiCache は、Global Datastore ID の作成時にプレフィックスを自動的に適用します。各 AWS リージョンには独自のプレフィックスがあります。例えば、米国西部 (北カルフォルニア) リージョンで作成された Global Datastore ID は、指定したサフィックス名と共に「virxk」で始まります。サフィックスは、自動生成されたプレフィックスと組み合わされて、複数のリージョンにまたがるグローバルデータストア名の一意性を保証します。

  次の表に、各 AWS リージョンとそのグローバルデータストア ID プレフィックスを示します。

    
****    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/AmazonElastiCache/latest/dg/Redis-Global-Datastores-CLI.html)
+  [[create-replication-group](https://docs.aws.amazon.com/cli/latest/reference/elasticache/create-replication-group.html)] – このオペレーションを使用して、Global Datastore の名前を `--global-replication-group-id` パラメータに指定することで、Global Datastore のセカンダリクラスターを作成します。

  ```
  aws elasticache create-replication-group \
    --replication-group-id {{secondary replication group name}} \
    --replication-group-description {{“Replication group description"}} \
    --global-replication-group-id {{global datastore name}}
  ```

  このオペレーションを呼び出して `--global-replication-group-id` 値を渡す際、ElastiCache は、グローバルレプリケーショングループのプライマリレプリケーショングループから次のパラメータの値を推測します。これらのパラメータには値を渡さないでください。

  `"PrimaryClusterId",`

  `"AutomaticFailoverEnabled",`

  ` "NumNodeGroups",`

  ` "CacheParameterGroupName",`

  ` "CacheNodeType",`

  ` "Engine",`

  ` "EngineVersion",`

  ` "CacheSecurityGroupNames",`

  ` "EnableTransitEncryption",`

  ` "AtRestEncryptionEnabled",`

  ` "SnapshotArns",`

  ` "SnapshotName"`
+ [describe-global-replication-groups](https://docs.aws.amazon.com/cli/latest/reference/elasticache/describe-global-replication-groups.html)

  ```
  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](https://docs.aws.amazon.com/cli/latest/reference/elasticache/modify-global-replication-group.html)

  ```
  aws elasticache modify-global-replication-group \
     --global-replication-group-id {{my global datastore }} \
     --automatic-failover-enabled \
     --cache-node-type {{node type}} \
     --cache-parameter-group-name {{parameter group name}} \ 
     --engine-version {{engine version}} \
     -—apply-immediately \
     --global-replication-group-description {{description}}
  ```

  **ElastiCache GlobalDataStore の Redis OSS から Valkey へのクロスエンジンアップグレード**

  コンソール、API、または CLI を使用して、既存の Redis OSS グローバルレプリケーショングループを Valkey にアップグレードできます。

  既存の Redis OSS グローバルレプリケーショングループがある場合は、modify-global-replication-group API で新しいエンジンとエンジンバージョンを指定することで、Valkey にアップグレードできます。

  Linux、macOS、Unix の場合:

  ```
  aws elasticache modify-global-replication-group \
     --global-replication-group-id myGlobalReplGroup \
     --engine valkey \
     --apply-immediately \
     --engine-version 8.0
  ```

  Windows の場合:

  ```
  aws elasticache modify-global-replication-group ^
     --global-replication-group-id myGlobalReplGroup ^
     --engine valkey ^
     --apply-immediately ^
     --engine-version 8.0
  ```

  アップグレードする既存の Redis OSS グローバルレプリケーショングループに適用されたカスタムキャッシュパラメータグループがある場合は、リクエストでカスタムの Valkey キャッシュパラメータグループも渡す必要があります。入力された Valkey カスタムパラメータグループは、既存の Redis OSS カスタムパラメータグループと同じ Redis OSS 静的パラメータ値を持っている必要があります。

  Linux、macOS、Unix の場合:

  ```
  aws elasticache modify-global-replication-group \
     --global-replication-group-id myGlobalReplGroup \
     --engine valkey \
     --engine-version 8.0 \
     --apply-immediately \
     --cache-parameter-group-name myParamGroup
  ```

  Windows の場合:

  ```
  aws elasticache modify-global-replication-group ^
     --global-replication-group-id myGlobalReplGroup ^
     --engine valkey ^
     --engine-version 8.0 ^
     --apply-immediately ^
     --cache-parameter-group-name myParamGroup
  ```
+ [delete-global-replication-group](https://docs.aws.amazon.com/cli/latest/reference/elasticache/delete-global-replication-group.html)

  ```
  aws elasticache delete-global-replication-group \
     --global-replication-group-id {{my global datastore }} \
     --retain-primary-replication-group {{defaults to true }}
  ```
+ [disassociate-global-replication-group](https://docs.aws.amazon.com/cli/latest/reference/elasticache/disassociate-global-replication-group.html)

  ```
  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](https://docs.aws.amazon.com/cli/latest/reference/elasticache/failover-global-replication-group.html)

  ```
  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](https://docs.aws.amazon.com/cli/latest/reference/elasticache/increase-node-groups-in-global-replication-group.html)

  ```
  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](https://docs.aws.amazon.com/cli/latest/reference/elasticache/decrease-node-groups-in-global-replication-group.html)

  ```
  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](https://docs.aws.amazon.com/cli/latest/reference/elasticache/rebalance-slots-in-global-replication-group.html)

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

ヘルプを使用して、ElastiCache for Valkey または ElastiCache for Redis OSS で使用可能なすべてのコマンドを一覧表示します。

```
aws elasticache help
```

また、ヘルプを使用して、特定コマンドを記述したり、その用法の詳細を確認したりすることもできます。

```
aws elasticache create-global-replication-group help
```