Working with Keyspaces in Amazon Keyspaces - Amazon Keyspaces(针对 Apache Cassandra)
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门


Working with Keyspaces in Amazon Keyspaces

This section provides details about working with keyspaces in Amazon Keyspaces (for Apache Cassandra).

Creating Keyspaces in Amazon Keyspaces

Amazon Keyspaces performs data definition language (DDL) operations, such as creating and deleting keyspaces, asynchronously. You can monitor the creation status of new keyspaces in the AWS Management Console, which will indicate when a keyspace is pending or active. You can also monitor the creation status of a new keyspace programmatically by using the system schema table. A keyspace will become visible in the system schema once it is ready for use. The recommended design pattern to check when a new keyspace is ready for use is to poll the Amazon Keyspaces system schema tables (system_schema_mcs.*). For a list of DDL statements for keyspaces, see the Keyspaces section in the CQL language reference.

The following query shows whether a keyspace has been successfully created.

SELECT * FROM system_schema_mcs.keyspaces WHERE keyspace_name = 'mykeyspace';

For a keyspace that has been successfully created the output of the query looks like the following.

keyspace_name | durable_writes | replication --------------+-----------------+-------------- mykeyspace | true |{...} 1 item