Cassandra数据复制问题

Raj*_*jan 8 replication cassandra

I have a 2 node cassandra cluster with a replication factor of 2 and AutoBootStrap=true. Everything is good during startup and both nodes see each other. Let us call these nodes A and B.

  1. Add a set of keys and columns (lets call this set K1) to cassandra through node A.
  2. Connect to node A and read back set K1. Same on Node B. Success - Good
  3. Kill Cassandra process on Node B.
  4. Add set K2 through A.
  5. Connect to node A and read set K2. Good
  6. Restart Cassandra process on Node B.
  7. Try to read all keys from B... set K1 present, set K2 MISSING. (Even after 30 minutes)
  8. Add K3 to A/B.
  9. Read all keys from A - returns set K1, K2, K3
  10. Read all keys from B - returns set K1, K3.

B never syncs set K2... (Its been more than 12 hours) Why does node B not see set K2... anyone has any idea?


Added Info :

Ok... this was the problem. The read_consistency_level was set to 1 by default.

So when we ask node B for set K2, and it doesnt have it (when it is supposed to because of the replication factor = 2), it immediately returns with a 'Not found' error.

However, if we use read consistency to be QUORUM or ALL, then B is forced to ask A, which then returns the correct value and B syncs up that key (saves it locally).

This leads to another problem - This means that when node B comes up, it is not syncing all the data from Node A, even after a long time. Now if node A goes down, how can we access that unsynced data? (I just tested that we cant)

我想必须有办法强制同步数据.我在终端输出中看到INFO,当B出现时,从A到B的15行的暗示切换发生,但是B没有本地的那些行(因为我们仍然无法从B中读取它的一致性级别为1).这里发生了什么?

jbe*_*lis 6

在节点关闭时,cassandra同步更新有3种方式:

  1. 暗示交接.要求A上的故障检测器在写入K2之前识别B已关闭.请参见http://wiki.apache.org/cassandra/HintedHandoff
  2. 阅读修理.当要求K2进行修复时,要求B启动.请参阅http://wiki.apache.org/cassandra/ReadRepair
  3. 反熵修复.需要手动调用("nodetool repair").请参阅http://wiki.apache.org/cassandra/AntiEntropy