

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用 Amazon CLI 在现有 Amazon MSK 集群上启用分层存储
<a name="msk-enable-cluster-tiered-storage-cli"></a>

**注意**  
只有在集群的 log.cleanup.policy 设置为 `delete` 时，才能启用分层存储，因为分层存储不支持压缩主题。如果未在该特定主题上启用分层存储，稍后可以将该主题的 log.cleanup.policy 配置为 `compact`。有关支持的配置属性的更多详细信息，请参阅 [Topic-level configuration](https://docs.amazonaws.cn//msk/latest/developerguide/msk-configuration-properties.html#msk-topic-confinguration)。

1. **更新 Kafka 版本**：集群版本并非简单的整数。要查找集群的当前版本，请使用`DescribeCluster`操作或 `describe-cluster` Amazon CLI 命令。示例版本是 `KTVPDKIKX0DER`。

   ```
   aws kafka update-cluster-kafka-version --cluster-arn ClusterArn --current-version Current-Cluster-Version --target-kafka-version 3.6.0
   ```

1. 编辑集群存储模式。以下代码示例显示如何使用 [https://docs.amazonaws.cn/cli/latest/reference/kafka/update-storage.html](https://docs.amazonaws.cn/cli/latest/reference/kafka/update-storage.html) API 将集群存储模式编辑为 `TIERED`。

   ```
   aws kafka update-storage --current-version Current-Cluster-Version --cluster-arn Cluster-arn --storage-mode TIERED
   ```