Cassandra 集群是否绝对需要至少 3 个节点/服务器,还是 2 个就足够了?
当然可以运行单节点集群,但我想要一定程度的容错能力。
目前,我可以租用两台服务器(8GB RAM,专用 VLAN @1GigE),但不能租用 3 台。
我的理解是,Cassandra 集群最少需要 3 个节点,因为 2 个节点之间不可能存在多数,而需要多数用于解决版本控制冲突。哦等等,我是在想“矢量时钟”和 Riak 吗?确认! Cassandra 使用时间戳来解决冲突。
对于2个节点,推荐的读/写策略是什么?我通常应该写入所有(两个)节点并从一个节点读取(N=2;W=N/2+1;W=2/2+1=2)吗?即使对于 2 个节点,Cassandra 也会照常使用提示切换,是吗?
这两台服务器位于同一个数据中心 FWIW。
谢谢!
Surely one can run a single node cluster but I'd like some level of fault-tolerance.
At present I can afford to lease two servers (8GB RAM, private VLAN @1GigE) but not 3.
My understanding is that 3 nodes is the minimum needed for a Cassandra cluster because there's no possible majority between 2 nodes, and a majority is required for resolving versioning conflicts. Oh wait, am I thinking of "vector clocks" and Riak? Ack! Cassandra uses timestamps for conflict resolution.
For 2 nodes, what is the recommended read/write strategy? Should I generally write to ALL (both) nodes and read from ONE (N=2; W=N/2+1; W=2/2+1=2)? Cassandra will use hinted-handoff as usual even for 2 nodes, yes?
These 2 servers are located in the same data center FWIW.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要 RF=2、clustersize=2 系统上的可用性,那么您不能使用 ALL,否则当节点出现故障时您将无法写入。
这就是为什么人们推荐 3 个节点而不是 2 个节点,因为这样你就可以进行仲裁读+写,并且在单个节点出现故障时仍然具有强一致性和可用性。
只需 2 个节点,您就可以选择是否需要强一致性(使用 ALL 写入)或在单节点故障时保持可用性(使用 ONE 写入),但不能同时选择两者。当然,如果您使用 ONE cassandra 进行编写,则会根据需要进行暗示的切换等,以使其最终保持一致。
If you need availability on a RF=2, clustersize=2 system, then you can't use ALL or you will not be able to write when a node goes down.
That is why people recommend 3 nodes instead of 2, because then you can do quorum reads+writes and still have both strong consistency and availability if a single node goes down.
With just 2 nodes you get to choose whether you want strong consistency (write with ALL) or availability in the face of a single node failure (write with ONE) but not both. Of course if you write with ONE cassandra will do hinted handoff etc as needed to make it eventually consistent.