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
TcpDiscoverySpiAdapter.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_pem_file"/> <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
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.
|
void |
setCredential(String credential)
Sets credential that is used during authentication on the cloud.
|
void |
setCredentialPath(String credentialPath)
Sets the path to a credential that is used during authentication on the cloud.
|
void |
setIdentity(String identity)
Sets the identity that is used as a user name during a connection to the cloud.
|
void |
setProvider(String provider)
Sets the cloud provider to use.
|
void |
setRegions(Collection<String> regions)
Sets list of regions where VMs are located.
|
void |
setZones(Collection<String> zones)
Sets list of zones where VMs are located.
|
void |
unregisterAddresses(Collection<InetSocketAddress> addrs)
Unregisters provided addresses.
|
close, initializeLocalAddresses, isShared, onSpiContextDestroyed, onSpiContextInitialized, setShared, spiContext, toString
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 void setProvider(String provider)
provider
- Provider name.@IgniteSpiConfiguration(optional=false) public void setIdentity(String identity)
identity
- Identity to use during authentication on the cloud.@IgniteSpiConfiguration(optional=true) public void setCredential(String credential)
credential
- Credential to use during authentication on the cloud.@IgniteSpiConfiguration(optional=true) public void setCredentialPath(String credentialPath)
credentialPath
- Path to the credential to use during authentication on the cloud.@IgniteSpiConfiguration(optional=true) public void 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.@IgniteSpiConfiguration(optional=true) public void setRegions(Collection<String> regions)
regions
- Regions where VMs are located or null if to check every region a provider has.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.1.0-incubating Release Date : May 20 2015