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 static org.slf4j.Logger |
logger |
static java.lang.String |
ZONE_NAME_QUERY |
Constructor and Description |
---|
Ec2Snitch() |
Ec2Snitch(SnitchProperties props) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDatacenter(InetAddressAndPort endpoint)
Return the data center for which an endpoint resides in
|
java.lang.String |
getRack(InetAddressAndPort endpoint)
Return the rack for which an endpoint resides in
|
boolean |
validate(java.util.Set<java.lang.String> datacenters,
java.util.Set<java.lang.String> racks)
Determine if the datacenter or rack values in the current node's snitch conflict with those passed in parameters.
|
compareEndpoints
gossiperStarting, isWorthMergingForRangeQuery, sortedByProximity
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDatacenter, getLocalDatacenter, getLocalRack
protected static final org.slf4j.Logger logger
public static final java.lang.String ZONE_NAME_QUERY
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 java.lang.String getRack(InetAddressAndPort endpoint)
AbstractNetworkTopologySnitch
getRack
in interface IEndpointSnitch
getRack
in class AbstractNetworkTopologySnitch
endpoint
- a specified endpointpublic java.lang.String getDatacenter(InetAddressAndPort endpoint)
AbstractNetworkTopologySnitch
getDatacenter
in interface IEndpointSnitch
getDatacenter
in class AbstractNetworkTopologySnitch
endpoint
- a specified endpointpublic boolean validate(java.util.Set<java.lang.String> datacenters, java.util.Set<java.lang.String> racks)
IEndpointSnitch
Copyright © 2009- The Apache Software Foundation