Question-: You have node Apache Cassandra cluster where consistency level is set as QUORUM as well as replication factor is . (CL=QUORUM , RF=). When write happens and one of the node goes down, what would happen in this case (other settings are default)?
A. Coordinated node will store the hint B. As writes already done on 2 nodes, it will return successful write. C. Coordinated node will return UnavailableException D. When failed nodes comes back after 6 hours, coordinated nodes will replay the hint. So that 3rd copy of data will be created.
Answer: A, B Exp: You always think consistency level and replication factor together. As Cassandra has tunable consistency you can set it as per your need. In the given case CL=QUORUM and RF=3. It means when write is happening from a coordinator node. And if one of the node is down where data needs to be copied. Coordinator node will store the information which needs to be copied on the failed node in a specified directory for default 3 hours only. And if node comes back within 3 hours it will replay the data from hint to the node. However, as we have consistency level set as QUORUM (it means more than RF/2) nodes reply or acknowledge the successful write in this case 3/2=1.5. Means at least 2 nodes has to acknowledge.
As hint are saved only for 3 hours by default. Hence, node which come back after 6 hours will not get the hint from coordinated node.
Admin and Dev both
Question-: You have node cluster with setting as CL=ANY and RF=, What happen when all the nodes are down where data needs to be written (Assume other settings are default)?
A. It means coordinator node will store the hints. B. Even all 3 nodes are down, it will return successful write. C. It will wait for one of the 3 nodes to come back until than write will hangs. D. If all the nodes come back after 4 hours all the replicas will be copied from coordinated node. E. None of the above
Answer: A, B Exp: We should avoid using the consistency level as ANY. Reason being when all the 3 nodes are down where the data should be written. But as coordinator node has written the hint. It return the write as successful and which is not correct. Because when you send a read request for that hinted record, it will not return a result. Because data is not available on any of the three nodes as well as these all three nodes are down.
As hints are saved only for 3 hours by default. Hence, nodes come back after 3 hours, hints will not be plated ion the replica nodes.
Admin only
Question-: Which of the following would help in keeping the data in sync across the cluster? A. Hinted Handdoff B. Read Repair C. Anti-entropy repair
Answer: A,B,C
Explanation: In Cassandra there are 3 mechanism by which data kept in sync. Which are hinted handoff, read repair, and anti-entropy repair. There are two types of read repair as below - Foreground: It is a blocking, before returning the data all the replicas will be brought in sync. - Background: It is a non-blocking. Means data would be return to the client and all the repair operation will be done in the background.