将一个新节点添加到Cassandra部署

我有一个包含单个节点的基本Cassandra部署。 我想向部署中添加第二个节点,并且我希望客户端可以访问相同的数据,而不pipe它们正在与哪个节点交谈(即在给定的密钥空间内部,特定的查询应该在任何节点上产生相同的结果节点,除非最近的更新尚未完全传播)。

我的密钥空间的复制因子是2。

所以无论如何,我遵循这里的指示 (虽然我不知道我是否使用'虚拟'节点…我应该做任何在Cassandra 2.1下默认),并且节点似乎是相互通信:

# nodetool status Datacenter: DC1 =============== Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns Host ID Rack UN xxx.xxx.234.252 563.02 MB 1024 ? xxxxxxxx-0b3e-4fd3-9e63-xxxxxxxxxxxx RAC1 UN xxx.xxx.194.188 923.45 KB 1024 ? xxxxxxxx-84cb-4260-84df-xxxxxxxxxxxx RAC2 

但是,我没有看到任何数据传播到新节点的证据。 例如,它的cfstats看起来像这样:

 Read Count: 290 Read Latency: 0.1124551724137931 ms. Write Count: 35 Write Latency: 0.12919999999999998 ms. Pending Flushes: 0 Table: assetproperties SSTable count: 0 Space used (live): 0 Space used (total): 0 Space used by snapshots (total): 0 Off heap memory used (total): 0 SSTable Compression Ratio: 0.0 Number of keys (estimate): 34 

…在原始节点上,它们看起来像这样:

 Read Count: 90 Read Latency: 1.674811111111111 ms. Write Count: 0 Write Latency: NaN ms. Pending Flushes: 0 Table: assetproperties SSTable count: 3 Space used (live): 305561510 Space used (total): 305561510 Space used by snapshots (total): 0 Off heap memory used (total): 773076 SSTable Compression Ratio: 0.22460684186840507 Number of keys (estimate): 416712 

如果我使用cqlsh连接到新节点,我会得到非常不一致的结果。 查询我所知道的密钥是否存在于数据集中,会产生无结果或variables结果。 和in一样,有时一行会返回正确的数据,有时Cassandra会通知我没有与查询匹配的行。 如果我连接到原始节点,一切正常,它应该。

这只是卡桑德拉“最终一致性”的副作用吗? 如果是这样,大约需要多长时间才能让新节点开始可靠地返回有用的数据?

还是有一些额外的步骤,需要手动完成,以获得新的节点工作在一个更合理/一致的方式?

我怀疑我可能会得到更好的结果,如果我在cqlsh设置consistency all ,但试图这样做只是给我以下错误:

 ReadTimeout: code=1200 [Coordinator node timed out waiting for replica nodes' responses] message="Operation timed out - received only 1 responses." info={'received_responses': 1, 'required_responses': 2, 'consistency': 'ALL' } 

那是因为数据还没有被复制到新的节点呢?

我相信我find了答案。 有必要在原始节点上运行nodetool repair ,以使新节点正常工作。

节点上运行nodetool repair可能看起来更直观正确,但试图这样做只是导致修复过程永远挂起而没有日志输出。

修复过程完成后,新节点上的数据始终可用,并且在cqlsh中设置的consistency all也开始正常工作。

运行nodetool repair时,我也收到了一堆“丢失通知”消息。 但是,这些似乎是无害的 。