我应该使用哪个cqlsh命令来快速查看集群中的键空间? cqlsh没有提供show keyspaces
,而describe cluster
不够简洁。
我正在使用以下规格:
cqlsh 2.2.0,Cassandra 1.1.10,CQL规范2.0.0,Thrift协议19.33.0
非常简单。只需在您的cqlsh shell中输入此命令,即可享受。
select * from system.schema_keyspaces;
在 C*3.x 中,我们可以简单地使用
describe keyspaces
cqlsh> select * from system_schema.keyspaces;
keyspace_name | durable_writes | replication
--------------------+----------------+-------------------------------------------------------------------------------------
system_auth | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1'}
system_schema | True | {'class': 'org.apache.cassandra.locator.LocalStrategy'}
system_distributed | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'}
system | True | {'class': 'org.apache.cassandra.locator.LocalStrategy'}
system_traces | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '2'}
Cassandra 3.0
。您可以使用以下查询验证您的版本:SELECT release_version from system.local;
参考:从system.schema_keyspaces查询生成code=2200 - benSoorajList<KeyspaceMetadata> keyspaces = Cluster.getMetadata().getKeyspaces()