Assess your understanding of Cassandra data replication strategies, consistency levels, and related concepts. This quiz covers replication factors, consistency mechanisms, quorum reads and writes, and how these settings impact reliability and performance in distributed database systems.
What is the main purpose of setting a replication factor for a keyspace in Cassandra?
Explanation: The replication factor specifies how many nodes will contain copies of each piece of data, enhancing fault tolerance and availability. Increasing partition size, limiting queries, and setting compaction frequency are unrelated; those are managed by different settings and processes.
When using the consistency level 'ONE' for a read operation in Cassandra, what is required for the operation to succeed?
Explanation: With the 'ONE' consistency level, only a single replica needs to respond with the data, making it faster but less safe than requiring more nodes. 'ALL' would require all replicas, 'QUORUM' needs a majority, and clients never need to contact every node directly.
What does the 'QUORUM' consistency level mean when executing a write operation in Cassandra with a replication factor of three?
Explanation: 'QUORUM' represents a majority of replicas, so with a replication factor of three, two nodes must confirm the write. 'ALL' would need three, 'ONE' needs only one, and sending a write to any node regardless of replica status ignores how replication works.
Which replication strategy should you choose to distribute data evenly across data centers in a multi-location setup?
Explanation: NetworkTopologyStrategy is designed for distributing replicas across multiple data centers to improve reliability. SimpleStrategy is intended for single data center use, LocalStrategy is for internal system tables only, and SingleReplication is not a recognized option.
What is the function of read repair in Cassandra?
Explanation: Read repair helps keep replicas synchronized by updating any that have stale data during a read. Backing up, compressing SSTables, and changing the replication factor are distinct processes unrelated to read repair.
What does 'eventual consistency' mean in distributed databases like Cassandra?
Explanation: Eventual consistency allows some replicas to be temporarily out of sync, but if no new writes are made, all replicas will become consistent. Instant consistency across nodes is strong consistency, data being never synchronized is not accurate, and only one replica holding the latest copy is incorrect.
What is the effect of increasing the replication factor from two to three in Cassandra?
Explanation: A higher replication factor means more copies of data, improving availability and resilience against node failures. It does not reduce required nodes, alter partition sizes, or affect the automatic repair processes.
What must happen for a write at the 'ALL' consistency level to be considered successful in Cassandra?
Explanation: The 'ALL' consistency level requires a write to be confirmed by every replica, ensuring the strongest consistency but sacrificing availability in the event a replica is down. The coordinator alone logging the write is insufficient, a single replica is not enough, and 'any two' ignores the total replica count.
If a write is performed with the consistency level 'ONE' and the only responding node fails before replicating to others, what risk does this pose?
Explanation: Using 'ONE' means only one replica needs to acknowledge the write, so if it fails quickly, the data isn't safe yet. Full safety would need higher consistency, replicas are not always immediately identical with 'ONE', and consistency levels do not automatically upgrade.
Why is tunable consistency considered an advantage in Cassandra?
Explanation: Tunable consistency lets users choose the right trade-off for their application, prioritizing speed or reliability as needed. Always enforcing the strongest consistency eliminates this flexibility. Automatic repair and improved query speed are unrelated to tunable consistency itself.