Database Reference
In-Depth Information
Read in action
Similar to a write case, when StorageProxy of the node that a client is connected to
gets the request, it gets a list of nodes containing this key based on the replication strategy.
The node's StorageProxy then sorts the nodes based on their proximity to itself. The
proximity is determined by the snitch function that is set up for this cluster. Basically, the
following types of snitches exist:
SimpleSnitch : A closer node is the one that comes first when moving clock-
wise in the ring. (A ring is when all the machines in the cluster are placed in a cir-
cular fashion with each machine having a token number. When you walk clock-
wise, the token value increases. At the end, it snaps back to the first node.)
PropertyFileSnitch : This snitch allows you to specify how you want your
machines' location to be interpreted by Cassandra. You do this by assigning a data
center name and rack name for all the machines in the cluster in the
$CASSANDRA_HOME/conf/cassandra-topology.properties file.
Each node has a copy of this file and you need to alter this file each time you add
or remove a node. This is what the file looks like:
# Cassandra Node IP=Data Center:Rack
192.168.1.100=DC1:RAC1
192.168.2.200=DC2:RAC2
10.0.0.10=DC1:RAC1
10.0.0.11=DC1:RAC1
10.0.0.12=DC1:RAC2
10.20.114.10=DC2:RAC1
10.20.114.11=DC2:RAC1
GossipingPropertyFileSnitch : The PropertyFileSnitch is kind
of a pain, even when you think about it. Each node has the locations of all nodes
manually written and updated every time a new node joins or an old node retires.
And then, we need to copy it on all the servers. Wouldn't it be better if we just
specify each node's data center and rack on just that one machine, and then have
Cassandra somehow collect this information to understand the topology? This is
exactly what GossipingPropertyFileSnitch does. Similar to Proper-
tyFileSnitch , you have a file called $CASSANDRA_HOME/conf/
cassandra-rackdc.properties , and in this file you specify the data cen-
ter and the rack name for that machine. The gossip protocol makes sure that this
information gets spread to all the nodes in the cluster (and you do not have to edit
Search WWH ::




Custom Search