Package org.apache.cassandra.locator
Class PropertyFileSnitch
- java.lang.Object
-
- org.apache.cassandra.locator.AbstractEndpointSnitch
-
- org.apache.cassandra.locator.AbstractNetworkTopologySnitch
-
- org.apache.cassandra.locator.PropertyFileSnitch
-
- All Implemented Interfaces:
IEndpointSnitch
public class PropertyFileSnitch extends AbstractNetworkTopologySnitch
Used to determine if two IP's are in the same datacenter or on the same rack.
Based on a properties file in the following format: 10.0.0.13=DC1:RAC2 10.21.119.14=DC3:RAC2 10.20.114.15=DC2:RAC2 default=DC1:r1
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SNITCH_PROPERTIES_FILENAME
-
Constructor Summary
Constructors Constructor Description PropertyFileSnitch()
PropertyFileSnitch(int refreshPeriodInSeconds)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDatacenter(InetAddressAndPort endpoint)
Return the data center for which an endpoint resides instatic java.lang.String[]
getEndpointInfo(InetAddressAndPort endpoint)
Get the raw information about an end pointjava.lang.String
getRack(InetAddressAndPort endpoint)
Return the rack for which an endpoint resides invoid
gossiperStarting()
called after Gossiper instance exists immediately before it starts gossipingvoid
reloadConfiguration(boolean isUpdate)
-
Methods inherited from class org.apache.cassandra.locator.AbstractNetworkTopologySnitch
compareEndpoints
-
Methods inherited from class org.apache.cassandra.locator.AbstractEndpointSnitch
isWorthMergingForRangeQuery, sortedByProximity
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.locator.IEndpointSnitch
getDatacenter, getDatacenter, getLocalDatacenter, getLocalRack, validate
-
-
-
-
Field Detail
-
SNITCH_PROPERTIES_FILENAME
public static final java.lang.String SNITCH_PROPERTIES_FILENAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PropertyFileSnitch
public PropertyFileSnitch() throws ConfigurationException
- Throws:
ConfigurationException
-
PropertyFileSnitch
public PropertyFileSnitch(int refreshPeriodInSeconds) throws ConfigurationException
- Throws:
ConfigurationException
-
-
Method Detail
-
getEndpointInfo
public static java.lang.String[] getEndpointInfo(InetAddressAndPort endpoint)
Get the raw information about an end point- Parameters:
endpoint
- endpoint to process- Returns:
- a array of string with the first index being the data center and the second being the rack
-
getDatacenter
public java.lang.String getDatacenter(InetAddressAndPort endpoint)
Return the data center for which an endpoint resides in- Specified by:
getDatacenter
in interfaceIEndpointSnitch
- Specified by:
getDatacenter
in classAbstractNetworkTopologySnitch
- Parameters:
endpoint
- the endpoint to process- Returns:
- string of data center
-
getRack
public java.lang.String getRack(InetAddressAndPort endpoint)
Return the rack for which an endpoint resides in- Specified by:
getRack
in interfaceIEndpointSnitch
- Specified by:
getRack
in classAbstractNetworkTopologySnitch
- Parameters:
endpoint
- the endpoint to process- Returns:
- string of rack
-
reloadConfiguration
public void reloadConfiguration(boolean isUpdate) throws ConfigurationException
- Throws:
ConfigurationException
-
gossiperStarting
public void gossiperStarting()
Description copied from interface:IEndpointSnitch
called after Gossiper instance exists immediately before it starts gossiping- Specified by:
gossiperStarting
in interfaceIEndpointSnitch
- Overrides:
gossiperStarting
in classAbstractEndpointSnitch
-
-