Datastax Java API 如何在 cassandra 中将一致性级别处理为 ALL
How can Datastax Java API handle consistency level as ALL in cassandra
设置 我有 4 个节点用于 cassandra 集群(同一个数据中心)。复制因子为 3。写入一致性设置为 ALL
据我了解,Cassandra 没有主节点。因此,我可以根据需要将数据写入任何随机节点。假设我有03个节点A,B和C。我写入节点A记录123,值为4.
问题 1:Session 对象中的 execute() 方法是否会被阻塞,直到数据被复制到所有副本上?
另一种情况:假设123值为5的记录也写入了节点B,在插入值为4的记录123的请求到达节点后100毫秒A.
问题2:当B是A的副本时,cassandra在其架构中如何处理这种情况? cassandra 节点会使用它们的内部时间来决定哪个节点首先收到记录吗?还是所有副本共享同一个写数据锁?
问题3:当B不是A的副本时,我把读一致性设置为ALL。如果我在节点A或B上随机查询记录123的值,Cassandra如何处理这种情况?
我是 Cassandra 的新手,因此非常感谢任何回答或帮助。
非常感谢。
Will execute() method in Session object be blocked until the data has been replicated on all replicas ?
会话对象将被阻塞,直到收到 N 确认s 你的突变,N 取决于选择的一致性级别.在您的情况下,由于您使用的是 ALL,客户端将阻塞,直到收到来自所有副本的确认。
When B is a replica of A, how can cassandra handles this situation in its architecture? Will cassandra node use their internal time to decide which node received the record first? Or all replicas will share the same lock for writing data?
协调器节点(接收请求的节点)将并行调度写入到所有副本。对于像 Java 驱动程序这样的现代驱动程序,大多数时候选择 coordinator 节点,以便它是被插入分区的副本,以避免一个额外的网络跃点。
协调器的作用也是在你写的每一列上设置一个时间戳值。这个时间戳是一样的,会发给所有的副本
When B is not a replica of A, and I have read consistency is set to ALL. If I query for the value of record 123 randomly on node A or B, how can Cassandra handle this situation ?
在这种情况下,接收请求的节点称为 协调器,将通过将请求转发到适当的副本并转发响应来充当代理(s) 它接收回客户端。
每个节点都知道整个集群的拓扑结构(令牌范围,IP地址),因此每个节点都可以随时扮演协调器的角色。
有关 Cassandra 中如何处理数据分布的更多详细信息,请点击此处:http://www.slideshare.net/doanduyhai/cassandra-introduction-apache-con-2014-budapest/18
设置 我有 4 个节点用于 cassandra 集群(同一个数据中心)。复制因子为 3。写入一致性设置为 ALL
据我了解,Cassandra 没有主节点。因此,我可以根据需要将数据写入任何随机节点。假设我有03个节点A,B和C。我写入节点A记录123,值为4.
问题 1:Session 对象中的 execute() 方法是否会被阻塞,直到数据被复制到所有副本上?
另一种情况:假设123值为5的记录也写入了节点B,在插入值为4的记录123的请求到达节点后100毫秒A.
问题2:当B是A的副本时,cassandra在其架构中如何处理这种情况? cassandra 节点会使用它们的内部时间来决定哪个节点首先收到记录吗?还是所有副本共享同一个写数据锁?
问题3:当B不是A的副本时,我把读一致性设置为ALL。如果我在节点A或B上随机查询记录123的值,Cassandra如何处理这种情况?
我是 Cassandra 的新手,因此非常感谢任何回答或帮助。
非常感谢。
Will execute() method in Session object be blocked until the data has been replicated on all replicas ?
会话对象将被阻塞,直到收到 N 确认s 你的突变,N 取决于选择的一致性级别.在您的情况下,由于您使用的是 ALL,客户端将阻塞,直到收到来自所有副本的确认。
When B is a replica of A, how can cassandra handles this situation in its architecture? Will cassandra node use their internal time to decide which node received the record first? Or all replicas will share the same lock for writing data?
协调器节点(接收请求的节点)将并行调度写入到所有副本。对于像 Java 驱动程序这样的现代驱动程序,大多数时候选择 coordinator 节点,以便它是被插入分区的副本,以避免一个额外的网络跃点。
协调器的作用也是在你写的每一列上设置一个时间戳值。这个时间戳是一样的,会发给所有的副本
When B is not a replica of A, and I have read consistency is set to ALL. If I query for the value of record 123 randomly on node A or B, how can Cassandra handle this situation ?
在这种情况下,接收请求的节点称为 协调器,将通过将请求转发到适当的副本并转发响应来充当代理(s) 它接收回客户端。
每个节点都知道整个集群的拓扑结构(令牌范围,IP地址),因此每个节点都可以随时扮演协调器的角色。
有关 Cassandra 中如何处理数据分布的更多详细信息,请点击此处:http://www.slideshare.net/doanduyhai/cassandra-introduction-apache-con-2014-budapest/18