## org.apache.cassandra.locator
Class Ec2Snitch

    java.lang.Object
      org.apache.cassandra.locator.AbstractEndpointSnitch
          org.apache.cassandra.locator.AbstractNetworkTopologySnitch
              org.apache.cassandra.locator.Ec2Snitch

All Implemented Interfaces:
  IEndpointSnitch

Direct Known Subclasses:
  Ec2MultiRegionSnitch

    public class Ec2Snitch

extends AbstractNetworkTopologySnitch

A snitch that assumes an EC2 region is a DC and an EC2 availability_zone is a rack. This information is available in the config for the node.

Field Summary
`protected java.lang.String` `ec2region`
`protected java.lang.String` `ec2zone`
`protected static org.slf4j.Logger` `logger`
`protected static java.lang.String` `ZONE_NAME_QUERY_URL`

Constructor Summary
`Ec2Snitch()`

Method Summary
`java.lang.String` `getDatacenter(java.net.InetAddress endpoint)` Return the data center for which an endpoint resides in
`java.lang.String` `getRack(java.net.InetAddress endpoint)` Return the rack for which an endpoint resides in
`void` `gossiperStarting()` called after Gossiper instance exists immediately before it starts gossiping

Methods inherited from class org.apache.cassandra.locator.AbstractNetworkTopologySnitch
`compareEndpoints`

Methods inherited from class org.apache.cassandra.locator.AbstractEndpointSnitch
`getSortedListByProximity, sortByProximity`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### logger

    protected static org.slf4j.Logger logger

### ZONE_NAME_QUERY_URL

    protected static final java.lang.String ZONE_NAME_QUERY_URL

See Also:
  Constant Field Values

### ec2zone

    protected java.lang.String ec2zone

### ec2region

    protected java.lang.String ec2region

Constructor Detail

### Ec2Snitch

    public Ec2Snitch()
              throws java.io.IOException,
                     ConfigurationException

Throws:
  `java.io.IOException`
  `ConfigurationException`

Method Detail

### getRack

    public java.lang.String getRack(java.net.InetAddress endpoint)

  Description copied from class: `AbstractNetworkTopologySnitch`
  Return the rack for which an endpoint resides in

  Specified by:
    `getRack` in interface `IEndpointSnitch`
  Specified by:
    `getRack` in class `AbstractNetworkTopologySnitch`
  Parameters:
    `endpoint` - a specified endpoint
  Returns:
    string of rack

### getDatacenter

    public java.lang.String getDatacenter(java.net.InetAddress endpoint)

  Description copied from class: `AbstractNetworkTopologySnitch`
  Return the data center for which an endpoint resides in

  Specified by:
    `getDatacenter` in interface `IEndpointSnitch`
  Specified by:
    `getDatacenter` in class `AbstractNetworkTopologySnitch`
  Parameters:
    `endpoint` - a specified endpoint
  Returns:
    string of data center

### gossiperStarting

    public void gossiperStarting()

  Description copied from interface: `IEndpointSnitch`
  called after Gossiper instance exists immediately before it starts gossiping

  Specified by:
    `gossiperStarting` in interface `IEndpointSnitch`
  Overrides:
    `gossiperStarting` in class `AbstractEndpointSnitch`

Copyright © 2013 The Apache Software Foundation