DBMS/Cassandra

Cassandra Snitch

seungh0 2023. 3. 3. 07:53
반응형
  • determines which datacenters and racks nodes belong to.
  • they inform Cassandra about the network topology so that requests are routed efficiently and allows Cassandra to distribute replicas by grouping machines into datacenters and racks.

 

Strategy

Dynamic snitching

  • by default, all snitches also use a dynamic snitch layer that monitors read latency and where possible routes requests away from poorly-performing nodes.
  • The dynamic snitch is enabled by default and is recommended for use in most deployments.


SimpleSnitch

  • used only single-datacenter deployments.
  • it does not recognize datacenter or rack information and can used only for single-datacenter deployments or single-zone in public clouds.


RackInterringSnitch

  • determines thre proximity of nodes by rack and datacenter, which are assumed to correspond thre 3rd and 2nd octet of node’s IP addresses.


PropertyFileSnitch

  • it uses the network details located in the cassandra-topology.properties
# datacenter One

175.56.12.105=DC1:RAC1
175.50.13.200=DC1:RAC1
175.54.35.197=DC1:RAC1

120.53.24.101=DC1:RAC2
120.55.16.200=DC1:RAC2
120.57.102.103=DC1:RAC2

# datacenter Two

110.56.12.120=DC2:RAC1
110.50.13.201=DC2:RAC1
110.54.35.184=DC2:RAC1

50.33.23.120=DC2:RAC2
50.45.14.220=DC2:RAC2
50.17.10.203=DC2:RAC2

# Analytics Replication Group

172.106.12.120=DC3:RAC1
172.106.12.121=DC3:RAC1
172.106.12.122=DC3:RAC1

# default for unknown nodes 
default =DC3:RAC1


GossipPropertyFileSnitch

  • this snitch is recommended for production.
  • it uses rack and datacenter information for thre local node defined in cassandra-rackdc.properties file and propagates this information to other nodes via gossip.
  • dc=DC1 rack=RAC1
  • to save bandwidth, add thre prefer_local=true option.
    • this option tells Cassandra to use the local IP address when communication is not across different datacenters.
반응형