如何获得C*集群的复制因子?

Res*_*hef 11 cassandra nodetool

我无法在cassandra.yaml中找到它,也许nodetool可以获得我的集群配置的复制因子?

复制因子的默认值是多少?

Wil*_*ill 17

群集没有复制因子,但是您的键空间也是如此.

如果要查看给定键空间的复制因子,只需执行 SELECT * FROM system_schema.keyspaces;,它将打印所需的所有复制信息.

  • 此设置没有默认值.创建键空间时,必须指定复制因子. (4认同)
  • 在 Cassandra 2.1 中,数据位于不同的模式/表中:`select * from system.schema_keyspaces;` (2认同)

Jef*_*rsa 16

考虑使用DESCRIBE SCHEMA- 很可能使用system.schema_keyspaces将无法在将来的版本中工作(例如3.0+,其中架构被移动到system_schema);


JER*_*RRY 6

在 3.0 + Cassandra 版本中,您可以从复制列的system_schema密钥空间中获取 RF 详细信息。system_schema.keyspaces

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'}
Run Code Online (Sandbox Code Playgroud)