What cqlsh command can I use to quickly see the keyspaces in a cluster? cqlsh does not provide show keyspaces
and describe cluster
isn't as concise as I want.
I'm working using the following specifications:
cqlsh 2.2.0, Cassandra 1.1.10, CQL spec 2.0.0, Thrift protocol 19.33.0
Go to data tab > there you will see all keyspcaces created by you and some system keyspaces. You can see all tables under individual keyspaces and also replicator factor for keyspace.
You can store the output in a file, then import with 'cassandra-cli -f filename'. If using cqlsh, you can use the 'describe schema' command. You can restrict to a keyspace with 'describe keyspace keyspace'. You can save this to a file then import with 'cqlsh -f filename'.
In a Cassandra cluster, a keyspace is an outermost object that determines how data replicates on nodes. Keyspaces consist of core objects called column families (which are like tables in RDBMS), rows indexed by keys, data types, data center awareness, replication factor, and keyspace strategy.
EXIT − Using this command, you can terminate cqlsh. PAGING − Enables or disables query paging. SHOW − Displays the details of current cqlsh session such as Cassandra version, host, or data type assumptions. SOURCE − Executes a file that contains CQL statements.
Very simple. Just enter this command in your cqlsh shell and enjoy
select * from system.schema_keyspaces;
In C*3.x, we can simply use
describe keyspaces
Just try this:
describe keyspaces
However you may need specs of approximately the following (rather than those mentioned by yourself Crowie)
[cqlsh 4.1.1 | Cassandra 2.0.6 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
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'}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With