![]() |
VOOZH | about |
In this article, we will discuss the Snitch and its types and Understanding how to configure the cassandra-topology.properties and cassandra-rackdc.properties files helps configure data centers and clusters.
Snitches :
In Cassandra Snitch is very useful and snitch is also helps in keep record to avoid storing multiple replicas of data on the same rack. In Cassandra, it is very important aspects to avoid multiple replica. In replication strategy we assign number of replica and also we define the data-center. This information is very helpful for snitch to identify the node and which rack belong to.
In Cassandra, snitch job is to determine which data centers and racks it should use to read data from and write data to. In Cassandra, all snitch are dynamic by default.
Types of Snitches:
dc=DC1 rack=RACK1 prefer_local=true
Now, let's understand the cassandra-topology.properties and the cassandra-rackdc.properties Files.
Understanding the cassandra-topology.properties and the cassandra-rackdc.properties Files:
It contains the topology of entire cluster and the information of the cassandra-topology.properties and the cassandra-rackdc.properties Files.
Let's take an example.
dc = DC1 rack = RAC1 rack= RAC2
In below given example DC1 and DC2 are two physical datacenters and there are two rack for each of them. In Cassandra The PropertyFileSnitch uses the properties file which is cassandra-topologies.properties file to identify the cluster's node. If we don't identify cluster's nodes in the cassandra-topologies.properties file then database assumes that data are in default datacenter and rack.
# datacenter One 10.40.08.230 = DC1:RAC1 10.30.11.231 = DC1:RAC1 10.54.06.232 = DC1:RAC1 130.40.20.106 = DC1:RAC2 130.41.21.229 = DC1:RAC2 130.42.29.111 = DC1:RAC2 # datacenter Two 100.46.12.120 = DC2:RAC1 100.60.13.201 = DC2:RAC1 100.24.35.184 = DC2:RAC1 30.22.20.110 = DC2:RAC2 30.35.21.210 = DC2:RAC2 30.27.20.231 = DC2:RAC2
The Cassandra-topologies.properties file is very important to update while we are going to add or delete nodes from cluster then to make aware that the nodes belong to which datacenter and rack. from performance perspective it is very important to keep record that information to Cassandra.
Here, we are going to describe the cassandra-rackdc.properties file: In above given example we are using following information of node.
Let's have a look.
dc=DC1 rack=RAC1
Note:
There are following snitch types look up the cassandra-rackdc.properties file for identifying the nodes cluster information such that which data center and which rack belong to.
Let's have a look.
GossipingPropertyFileSnitch Ec2Snitch Ec2MultiRegionSnitch