Nodes discovery on a cloud platform is usually proven to be more challenging because JClouds, like most of the virtual environments, has the following limitations:
- Multicast is disabled;
- TCP addresses change every time a new image is started.
Although you can use TCP-based discovery in the absence of the Multicast, you still have to deal with constantly changing IP addresses and constantly updating the configuration. This creates a major inconvenience and makes configurations based on static IPs virtually unusable in such environments.
To mitigate constantly changing IP addresses problem, Ignite supports automatic node discovery by utilizing Apache jclouds multi-cloud toolkit via
For information about Apache jclouds please refer to jclouds.apache.org.
The IP finder forms nodes addresses by getting private and public IP addresses of all virtual machines running on the 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'.
This way all the nodes can try to connect to any formed IP address and initiate automatic grid node discovery.
Refer to Apache jclouds providers section to get the list of supported cloud platforms.
All virtual machines must start Ignite instances on the same port, otherwise they will not be able to discover each other using this IP finder.
Here is an example of how to configure Apache jclouds based IP finder:
<bean class="org.apache.ignite.configuration.IgniteConfiguration"> ... <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"> <!-- Configuration for Google Compute Engine. --> <property name="provider" value="google-compute-engine"/> <property name="identity" value="YOUR_SERVICE_ACCOUNT_EMAIL"/> <property name="credentialPath" value="PATH_YOUR_PEM_FILE"/> <property name="zones"> <list> <value>us-central1-a</value> <value>asia-east1-a</value> </list> </property> </bean> </property> </bean> </property> </bean>
TcpDiscoverySpi spi = new TcpDiscoverySpi(); TcpDiscoveryCloudIpFinder ipFinder = new TcpDiscoveryCloudIpFinder(); // Configuration for AWS EC2. ipFinder.setProvider("aws-ec2"); ipFinder.setIdentity(yourAccountId); ipFinder.setCredential(yourAccountKey); ipFinder.setRegions(Collections.<String>emptyList().add("us-east-1")); ipFinder.setZones(Arrays.asList("us-east-1b", "us-east-1e")); spi.setIpFinder(ipFinder); IgniteConfiguration cfg = new IgniteConfiguration(); // Override default discovery SPI. cfg.setDiscoverySpi(spi); // Start Ignite node. Ignition.start(cfg);
Refer to Cluster Configuration for more information on various cluster configuration properties.
Updated about 9 hours ago