public class AwsDiscoveryStrategyFactory extends Object implements DiscoveryStrategyFactory
AwsDiscoveryStrategy to Discovery SPIDiscoveryStrategyFactory.DiscoveryStrategyLevel| Constructor and Description |
|---|
AwsDiscoveryStrategyFactory() |
| Modifier and Type | Method and Description |
|---|---|
DiscoveryStrategyFactory.DiscoveryStrategyLevel |
discoveryStrategyLevel()
Level of the discovery strategy.
|
Collection<PropertyDefinition> |
getConfigurationProperties()
Returns a set of the expected configuration properties.
|
Class<? extends DiscoveryStrategy> |
getDiscoveryStrategyType()
Returns the type of the
DiscoveryStrategy itself. |
boolean |
isAutoDetectionApplicable()
Checks if Hazelcast is running on an AWS EC2 instance.
|
DiscoveryStrategy |
newDiscoveryStrategy(DiscoveryNode discoveryNode,
ILogger logger,
Map<String,Comparable> properties)
Instantiates a new instance of the
DiscoveryStrategy with the given configuration
properties. |
public Class<? extends DiscoveryStrategy> getDiscoveryStrategyType()
DiscoveryStrategyFactoryDiscoveryStrategy itself.getDiscoveryStrategyType in interface DiscoveryStrategyFactorypublic DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode, ILogger logger, Map<String,Comparable> properties)
DiscoveryStrategyFactoryDiscoveryStrategy with the given configuration
properties. The provided HazelcastInstance can be used to register instances in
a service registry whenever the discovery strategy is started.newDiscoveryStrategy in interface DiscoveryStrategyFactorydiscoveryNode - the current local DiscoveryNode, representing the local
connection information if running on a Hazelcast member, otherwise on
Hazelcast clients always nulllogger - the logger instanceproperties - the properties parsed from the configurationpublic Collection<PropertyDefinition> getConfigurationProperties()
DiscoveryStrategyFactorygetConfigurationProperties in interface DiscoveryStrategyFactorypublic boolean isAutoDetectionApplicable()
Note that this method returns false for any ECS environment, since currently there is no way to auto-configure
Hazelcast network interfaces (required for ECS).
To check if Hazelcast is running on EC2, we first check that the machine uuid starts with "ec2" or "EC2". There is a small chance that a non-AWS machine has uuid starting with the mentioned prefix. That is why, to be sure, we make an API call to a local, non-routable address http://169.254.169.254/latest/dynamic/instance-identity/. Finally, we also check if an IAM Role is attached to the EC2 instance, because without any IAM Role the Hazelcast AWS discovery won't work.
isAutoDetectionApplicable in interface DiscoveryStrategyFactoryhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/identify_ec2_instances.htmlpublic DiscoveryStrategyFactory.DiscoveryStrategyLevel discoveryStrategyLevel()
DiscoveryStrategyFactorydiscoveryStrategyLevel in interface DiscoveryStrategyFactoryCopyright © 2021 Hazelcast, Inc.. All rights reserved.