在 Amazon Keyspaces 中为表配置客户端时间戳 - Amazon Keyspaces(Apache Cassandra 兼容)
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

在 Amazon Keyspaces 中为表配置客户端时间戳

按照以下示例使用 Amazon Keyspaces、Cassandra 查询语言(CQL)或 Amazon Web Services Management Console,为现有表开启客户端时间戳。

Console
为现有表打开客户端时间戳(控制台)
  1. 登录 Amazon Web Services Management Console并打开 Amazon Keyspaces 控制台:https://console.aws.amazon.com/msk/home

  2. 选择要更新的表,然后选择其他设置选项卡。

  3. 其他设置选项卡上,前往修改客户端时间戳,然后选择打开客户端时间戳

  4. 选择保存更改以更改表的设置。

Cassandra Query Language (CQL)
使用 CQL 语句
  1. 使用 ALTER TABLE CQL 语句为现有表开启客户端时间戳。

    ALTER TABLE my_table WITH custom_properties = {'client_side_timestamps': {'status': 'enabled'}};;
  2. 要确认新表的客户端时间戳设置,请使用 SELECT 语句查看 custom_properties,如以下示例所示。

    SELECT custom_properties from system_schema_mcs.tables where keyspace_name = 'my_keyspace' and table_name = 'my_table';

    此语句的输出显示了客户端时间戳的状态。

    'client_side_timestamps': {'status': 'enabled'}
Amazon CLI
使用 Amazon CLI
  1. 您可以使用以下示例,通过 Amazon CLI 为现有表开启客户端时间戳。

    ./aws keyspaces update-table \ --keyspace-name my_keyspace \ --table-name my_table \ --client-side-timestamps 'status=ENABLED'
  2. 要确认表的客户端时间戳已打开,请运行以下代码。

    ./aws keyspaces get-table \ --keyspace-name my_keyspace \ --table-name my_table

    输出应类似于以下示例,且客户端时间戳的状态为 ENABLED

    { "keyspaceName": "my_keyspace", "tableName": "my_table", "resourceArn": "arn:aws:cassandra:us-east-2:555555555555:/keyspace/my_keyspace/table/my_table", "creationTimestamp": 1662681312.906, "status": "ACTIVE", "schemaDefinition": { "allColumns": [ { "name": "id", "type": "int" }, { "name": "date", "type": "timestamp" }, { "name": "name", "type": "text" } ], "partitionKeys": [ { "name": "id" } ], "clusteringKeys": [], "staticColumns": [] }, "capacitySpecification": { "throughputMode": "PAY_PER_REQUEST", "lastUpdateToPayPerRequestTimestamp": 1662681312.906 }, "encryptionSpecification": { "type": "AWS_OWNED_KMS_KEY" }, "pointInTimeRecovery": { "status": "DISABLED" }, "clientSideTimestamps": { "status": "ENABLED" }, "ttl": { "status": "ENABLED" }, "defaultTimeToLive": 0, "comment": { "message": "" } }