我无法在cassandra.yaml中找到它,也许nodetool可以获得我的群集配置的复制因子?
复制因子的默认值是什么?
答案 0 :(得分:16)
考虑使用DESCRIBE SCHEMA
- 使用system.schema_keyspaces
可能无法在将来的版本中运行(例如3.0+,其中架构已移至system_schema
);
答案 1 :(得分:15)
群集没有复制因子,但是您的keyspaces does。
如果要查看给定键空间的复制因子,只需执行SELECT * FROM system_schema.keyspaces;
,它将打印您需要的所有复制信息。
答案 2 :(得分:4)
在版本3.0 + Cassandra中,您可以从system_schema
复制列中的system_schema.keyspaces
键空间获取RF详细信息。
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'}
答案 3 :(得分:0)
复制因子在 Keysapce级别中定义。
要查看特定键空间的复制因子,请在cqlsh中使用以下查询:
desc KEYSPACE Keyspace_Name;
答案 4 :(得分:0)
对于Cassandra 3.11和更高版本:
cd /usr/local/cassandra/apache-cassandra-3.11.0/bin
./cqlsh
(您的Cassandra节点IP)SELECT * FROM system_schema.keyspaces;
输出:您将获得Cassandra中所有各个键空间的复制因子
答案 5 :(得分:0)
如果您不想使用 cqlsh
而只想从 终端 打印信息,请使用 nodetool
和名为 describe cluster 的命令,像这样:
[user@user ~]$ nodetool describecluster
它将打印非常有用和简短的信息,包括关于键空间的信息,如下所示:
Keyspaces:
system_schema -> Replication class: LocalStrategy {}
system -> Replication class: LocalStrategy {}
system_distributed -> Replication class: SimpleStrategy {replication_factor=3}
system_traces -> Replication class: SimpleStrategy {replication_factor=2}
system_auth -> Replication class: NetworkTopologyStrategy {dc1=3}
如果您要查找一个特定键空间复制信息,只需使用以下命令(在本例中,我们将询问 system_auth
键空间信息):
[user@user ~]$ nodetool describecluster | grep system_auth
..它会打印这样的信息:
system_auth -> Replication class: NetworkTopologyStrategy {dc1=3}