在cqlsh2中是否有一个明确的等价于“show keyspaces”的方法?

w8rqjzmb  于 2021-06-15  发布在  Cassandra
关注(0)|答案(4)|浏览(259)

我可以使用什么cqlsh命令快速查看集群中的键空间?cqlsh不提供 show keyspaces 以及 describe cluster 没有我想的那么简洁。
我使用以下规范工作:
cqlsh 2.2.0,cassandra 1.1.10,cql规范2.0.0,节俭协议19.33.0

pieyvz9o

pieyvz9o1#

非常简单。只需在cqlsh shell中输入这个命令,就可以享受了

select * from system.schema_keyspaces;

在c*3.x中,我们可以简单地使用

describe keyspaces
t30tvxxf

t30tvxxf2#

试试这个:

describe keyspaces

但是,您可能需要大约以下规格(而不是您自己提到的克罗伊)
[cqlsh 4.1.1 | cassandra 2.0.6 | cql规范3.1.1 |节俭协议19.39.0]

nwlls2ji

nwlls2ji3#

c*3.x系列的正确方法是:

List<KeyspaceMetadata> keyspaces = Cluster.getMetadata().getKeyspaces()

然后使用 getName() 在keyspacemetadata示例上。

mbzjlibv

mbzjlibv4#

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'}

相关问题