Database Reference
In-Depth Information
Node
A node is an instance of Cassandra. A Cassandra cluster is made up of many
nodes. If you are building a test cluster on a single machine and have multiple in-
stances of Cassandra running, each instance would be considered a node.
Replication Factor
Replication factor (RF) is a setting on a keyspace that determines how many cop-
ies of the data will reside in the cluster. A replication factor of 3 means that there
will be three copies of the data within a cluster. The replication factor also determ-
ines the number of nodes that return when using quorum reads/writes. A quorum
read/write means that the query will be sent to (RF/2 + 1). Given an RF of 3, the
query will be sent to two nodes (decimals are always rounded down). If you al-
ways do quorum reads and writes, you will always have consistent responses as at
least one node in the replica set has the data that is being queried.
Tunable Consistency
Because different reads/writes may have different needs in terms of consistency,
you can specify the consistency at read/write-time. Consistency level (CL) ANY is
for writes only and ensures that the write will persist on any server in the cluster.
CL ONE ensures that at least one server within the replica set will persist the
write or respond to the read; this is the minimum consistency level for reads. CL
QUORUM means the read/write will go to half of the nodes in the replica set plus
one. CL LOCAL_QUORUM is like QUORUM but applies to only those nodes within
the same data center. CL EACH_QUORUM is like QUORUM but ensures a quorum
read/write on each of the data centers. CL ALL ensures that all nodes in a replica
set will receive the read/write.
Due to the nature of quorum reads/writes, the minimum size cluster you can
have, and still survive a single node outage with consistent reads/writes, is a three-
node cluster with a replication factor of 3. This means that each quorum read/write
goes to two nodes; the third node will be eventually consistent. This allows you to
lose one node and still have consistent data.
In the event that a consistency level cannot be met (e.g., enough nodes are
down that the read/write cannot be guaranteed), Cassandra will respond with an
UnavailableException . If this happens, the application can decide to lower
the consistency level and try again or handle the error state.
Search WWH ::




Custom Search