当写入以一致性 EACH_QUORUM 和复制 4 与 2 个数据中心 DC1 和 DC2 副本放置 3 在 DC1 和 1 在 DC2 中执行时,哪个类选择第二个和第三个副本应该驻留的节点?告密者是 GossipingPropertyFileSnitch 和 NetworkTopologyStrategy。客户端使用 FileSystem.create 创建一个新文件并对其执行写入操作。第一个副本将根据 token 和行键哈希转到节点。第二个和第三个副本在 DC1 和 DC2 中去了哪里?
最佳答案
一致性级别与放置策略没有任何关系。很简单,在向客户端报告成功或失败之前,应该向协调器报告多少个节点。
每个 DC 根据其复制因子独立放置副本。所以在DC2中,只会按照分区函数存储唯一的副本。在 DC1 中,副本放置是根据以下文档完成的:http://www.datastax.com/docs/1.0/cluster_architecture/replication#networktopologystrategy
The NetworkTopologyStrategy determines replica placement independently within each data center as follows:
The first replica is placed according to the partitioner (same as with SimpleStrategy). Additional replicas are placed by walking the ring clockwise until a node in a different rack is found. If no such node exists, additional replicas are placed in different nodes in the same rack. NetworkTopologyStrategy attempts to place replicas on distinct racks because nodes in the same rack (or similar physical grouping) can fail at the same time due to power, cooling, or network issues.
关于hadoop - 具有多个数据中心的 Cassandra 中的副本放置逻辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28574210/