副本存储在cassandra环中的哪个节点?

问题描述 投票:0回答:1

数据基于rowkeys存储在环上,但副本的行键与原始行相同,然后副本将存储在环中的同一节点中。 cassandra如何决定存储副本的位置?

cassandra
1个回答
2
投票

数据分区器确定每个密钥的协调器节点。协调器节点是密钥的第一个副本,也称为主副本。如果复制因子为N,则密钥的协调节点将其复制到其他N-1个副本。

在SimpleStrategy中,后续节点或环上的节点紧接着顺时针方向跟随协调器节点被选为副本。

这个链接可以帮到你:http://distributeddatastore.blogspot.com/2015/08/cassandra-replication.html

您可以使用nodetool getendpoints获取副本的node_ip。例如:

nodetool getendpoints <keyspace_name> <table_name> <partition_key>

样品:

nodetool getendpoints musicdb artist 1

结果:

192.168.122.13
192.168.122.14
192.168.122.12
© www.soinside.com 2019 - 2024. All rights reserved.