View a markdown version of this page

第 4 步:(可选)清理 - Amazon Keyspaces(Apache Cassandra 兼容)
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

第 4 步:(可选)清理

按照以下步骤移除本教程中创建的所有 Amazon 资源。必须在父基础架构堆栈之前删除 Amazon Glue 任务堆栈,因为它们引用了其导出的值。

移除本教程中创建的资源
  1. 删除由引导程序创建的 Amazon S3 存储桶内容。YOURACCOUNTID替换为您的 Amazon 账户 ID。

    $ aws s3 rm s3://amazon-keyspaces-bulk-cli-aksglue-YOURACCOUNTID --recursive
  2. 删除由 bootstrap 命令创建的 Amazon Glue 任务堆栈。这些子堆栈必须在父堆栈之前删除。您可以使用以下命令。

    $ aws cloudformation delete-stack --stack-name aksglue-export $ aws cloudformation delete-stack --stack-name aksglue-import $ aws cloudformation delete-stack --stack-name aksglue-count

    等待子堆栈完成删除后再继续。您可以使用以下命令检查状态。

    $ aws cloudformation wait stack-delete-complete --stack-name aksglue-export $ aws cloudformation wait stack-delete-complete --stack-name aksglue-import $ aws cloudformation wait stack-delete-complete --stack-name aksglue-count
  3. 删除父 Amazon CloudFormation 堆栈。这将移除在本教程中创建的 Amazon S3 存储桶资源和 IAM 角色。

    $ aws cloudformation delete-stack --stack-name aksglue
  4. 如果您在上一步中创建了触发器,请使用以下命令将其删除。

    $ aws glue delete-trigger --name KeyspacesExportWeeklyTrigger
  5. 删除 Amazon Keyspaces 键空间和表。删除键空间会自动删除该键空间中的所有表。您可以使用以下任一选项。

    Amazon CLI
    $ aws keyspaces delete-keyspace --keyspace-name 'catalog'

    要确认键空间已删除,您可以使用以下命令。

    $ aws keyspaces list-keyspaces

    要先删除表,您可以使用以下命令。

    $ aws keyspaces delete-table --keyspace-name 'catalog' --table-name 'book_awards'

    要确认表已删除,您可以使用以下命令。

    $ aws keyspaces list-tables --keyspace-name 'catalog'

    有关更多信息,请参阅《Amazon CLI 命令参考》中的 delete-keyspacedelete-table

    cqlsh
    DROP KEYSPACE IF EXISTS "catalog";

    要验证您的密钥空间是否已删除,可以使用以下语句。

    SELECT * FROM system_schema.keyspaces ;

    键空间不应在此语句的输出中列出。请注意,删除密钥空间之前可能会有一段延迟。有关更多信息,请参阅 DROP KEYSPACE

    要先删除表,您可以使用以下命令。

    DROP TABLE "catalog"."book_awards";

    要确认表已删除,您可以使用以下命令。

    SELECT * FROM system_schema.tables WHERE keyspace_name = "catalog";

    表不应在此语句的输出中列出。请注意,删除表的过程中可能会有延迟。有关更多信息,请参阅 DROP TABLE