public class Ec2Snitch extends AbstractNetworkTopologySnitch
Ec2MetadataServiceConnector.EC2_METADATA_TYPE_PROPERTY
and
can be of value either 'v1' or 'v2'.
It is possible to specify custom URL of IMDS by Ec2MetadataServiceConnector.EC2_METADATA_URL_PROPERTY
.
A user is not meant to change this under normal circumstances, it is suitable for testing only.
IMDSv2 is secured by a token which needs to be fetched from IDMSv2 first, and it has to be passed in a header
for the actual queries to IDMSv2. Ec2Snitch is doing this automatically. The only configuration parameter exposed
to a user is Ec2MetadataServiceConnector.V2Connector.AWS_EC2_METADATA_TOKEN_TTL_SECONDS_HEADER_PROPERTY
which is by default set to Ec2MetadataServiceConnector.V2Connector.MAX_TOKEN_TIME_IN_SECONDS
. TTL has
to be an integer from the range [30, 21600].Modifier and Type | Field and Description |
---|---|
protected org.apache.cassandra.locator.Ec2MetadataServiceConnector |
connector |
protected java.lang.String |
ec2region |
protected java.lang.String |
ec2zone |
protected static org.slf4j.Logger |
logger |
static java.lang.String |
ZONE_NAME_QUERY |
Constructor and Description |
---|
Ec2Snitch() |
Ec2Snitch(SnitchProperties props) |
Ec2Snitch(SnitchProperties props,
org.apache.cassandra.locator.Ec2MetadataServiceConnector connector) |
Modifier and Type | Method and Description |
---|---|
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
|
compareEndpoints
getSortedListByProximity, gossiperStarting, isWorthMergingForRangeQuery, sortByProximity
protected static final org.slf4j.Logger logger
public static final java.lang.String ZONE_NAME_QUERY
protected java.lang.String ec2zone
protected java.lang.String ec2region
protected final org.apache.cassandra.locator.Ec2MetadataServiceConnector connector
public Ec2Snitch() throws java.io.IOException, ConfigurationException
java.io.IOException
ConfigurationException
public Ec2Snitch(SnitchProperties props) throws java.io.IOException, ConfigurationException
java.io.IOException
ConfigurationException
public Ec2Snitch(SnitchProperties props, org.apache.cassandra.locator.Ec2MetadataServiceConnector connector) throws java.io.IOException
java.io.IOException
public java.lang.String getRack(java.net.InetAddress endpoint)
AbstractNetworkTopologySnitch
getRack
in interface IEndpointSnitch
getRack
in class AbstractNetworkTopologySnitch
endpoint
- a specified endpointpublic java.lang.String getDatacenter(java.net.InetAddress endpoint)
AbstractNetworkTopologySnitch
getDatacenter
in interface IEndpointSnitch
getDatacenter
in class AbstractNetworkTopologySnitch
endpoint
- a specified endpointCopyright © 2009- The Apache Software Foundation