public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter
Implementation is based on Apache jclouds multi-cloud toolkit. For information about jclouds visit jclouds.apache.org.
setProvider(String)
)setIdentity(String)
)setCredential(String)
)setCredentialPath(String)
setRegions(Collection)
)setZones(Collection)
The finder forms nodes addresses, that possibly running Ignite, by getting private and public IPs of all
VMs in a cloud and adding a port number to them.
The port is either the one that is set with TcpDiscoverySpi.setLocalPort(int)
or
TcpDiscoverySpi.DFLT_PORT
.
Make sure that all VMs start Ignite instances on the same port, otherwise they will not be able to discover each
other using this IP finder.
Both registerAddresses(Collection)
and unregisterAddresses(Collection)
has no effect.
Note, this finder is only workable when it used directly by cloud VM.
Choose another implementation of TcpDiscoveryIpFinder
for local
or home network tests.
String accountId = "your_account_id"; String accountKey = "your_account_key"; TcpDiscoveryCloudIpFinder ipFinder = new TcpDiscoveryCloudIpFinder(); ipFinder.setProvider("aws-ec2"); ipFinder.setIdentity(accountId); ipFinder.setCredential(accountKey); ipFinder.setRegions(Collections.emptyList().add("us-east-1")); ipFinder.setZones(Arrays.asList("us-east-1b", "us-east-1e"));
<bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"> ... <property name="discoverySpi"> <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> <property name="ipFinder"> <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder"/> <property name="provider" value="google-compute-engine"/> <property name="identity" value="your_service_account_email"/> <property name="credentialPath" value="path_to_json_key"/> <property name="zones"> <list> <value>us-central1-a</value> <value>asia-east1-a</value> </list> </property> </bean> </property> <property name="socketTimeout" value="400"/> </bean> </property> ... </bean>
For information about Spring framework visit www.springframework.org
ignite
Constructor and Description |
---|
TcpDiscoveryCloudIpFinder()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Collection<InetSocketAddress> |
getRegisteredAddresses()
Gets all addresses registered in this finder.
|
void |
registerAddresses(Collection<InetSocketAddress> addrs)
Registers new addresses.
|
TcpDiscoveryCloudIpFinder |
setCredential(String credential)
Sets credential that is used during authentication on the cloud.
|
TcpDiscoveryCloudIpFinder |
setCredentialPath(String credentialPath)
Sets the path to a credential that is used during authentication on the cloud.
|
TcpDiscoveryCloudIpFinder |
setIdentity(String identity)
Sets the identity that is used as a user name during a connection to the cloud.
|
TcpDiscoveryCloudIpFinder |
setProvider(String provider)
Sets the cloud provider to use.
|
TcpDiscoveryCloudIpFinder |
setRegions(Collection<String> regions)
Sets list of regions where VMs are located.
|
TcpDiscoveryCloudIpFinder |
setShared(boolean shared)
Sets shared flag.
|
TcpDiscoveryCloudIpFinder |
setZones(Collection<String> zones)
Sets list of zones where VMs are located.
|
String |
toString() |
void |
unregisterAddresses(Collection<InetSocketAddress> addrs)
Unregisters provided addresses.
|
close, discoveryClientMode, initializeLocalAddresses, isShared, onSpiContextDestroyed, onSpiContextInitialized, spiContext
public Collection<InetSocketAddress> getRegisteredAddresses() throws IgniteSpiException
null
.IgniteSpiException
- In case of error.public void registerAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException
Implementation should accept duplicates quietly, but should not register address if it is already registered.
addrs
- Addresses to register. Not null
and not empty.IgniteSpiException
- In case of error.public void unregisterAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException
Implementation should accept addresses that are currently not registered quietly (just no-op).
addrs
- Addresses to unregister. Not null
and not empty.IgniteSpiException
- In case of error.@IgniteSpiConfiguration(optional=false) public TcpDiscoveryCloudIpFinder setProvider(String provider)
provider
- Provider name.this
for chaining.@IgniteSpiConfiguration(optional=false) public TcpDiscoveryCloudIpFinder setIdentity(String identity)
identity
- Identity to use during authentication on the cloud.this
for chaining.@IgniteSpiConfiguration(optional=true) public TcpDiscoveryCloudIpFinder setCredential(String credential)
credential
- Credential to use during authentication on the cloud.this
for chaining.@IgniteSpiConfiguration(optional=true) public TcpDiscoveryCloudIpFinder setCredentialPath(String credentialPath)
credentialPath
- Path to the credential to use during authentication on the cloud.this
for chaining.@IgniteSpiConfiguration(optional=true) public TcpDiscoveryCloudIpFinder setZones(Collection<String> zones)
setRegions(Collection)
}, will be
taken into account.
Note, that some cloud providers, like Rackspace, doesn't have a notion of a zone. For such
providers a call to this method is redundant.zones
- Zones where VMs are located or null if to take every zone into account.this
for chaining.@IgniteSpiConfiguration(optional=true) public TcpDiscoveryCloudIpFinder setRegions(Collection<String> regions)
regions
- Regions where VMs are located or null if to check every region a provider has.this
for chaining.public TcpDiscoveryCloudIpFinder setShared(boolean shared)
true
then it is expected that IP addresses registered
with IP finder will be seen by IP finders on all other nodes.setShared
in class TcpDiscoveryIpFinderAdapter
shared
- true
if this IP finder is shared.this
for chaining.public String toString()
toString
in class TcpDiscoveryIpFinderAdapter
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024