How to get the replication factor of C* cluster?
In the versions 3.0 + Cassandra you can get the RF details from the system_schema
keyspace in the system_schema.keyspaces
replication column.
cassandra@cqlsh:system_schema> 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'}
company | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '2'}
system | True | {'class': 'org.apache.cassandra.locator.LocalStrategy'}
jerry | True | {'class': 'org.apache.cassandra.locator.NetworkTopologyStrategy'}
system_traces | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '2'}
A cluster doesn't have a replication factor, however your keyspaces does.
If you want to look at the replication factor of a given keyspace, simply execute SELECT * FROM system_schema.keyspaces;
and it will print all replication information you need.
Consider using DESCRIBE SCHEMA
- it's likely that using system.schema_keyspaces
will fail to work in a future version (such as 3.0+, where schema is moved to system_schema
);