In the previous post we were talking about the situation when an Ignite cluster is deployed in Google Compute Engine network and we need to have nodes auto-discovery mechanism.
Well, Apache Ignite has Compute Engine specific solution to fill this gap but what's about many others cloud platforms? What if I want to use AWS, Rackspace, GoGrid or other cloud provider?
Do you need to switch back to annoying and fragile static IP configuration? Luckily, the answer - you don't!
Since 1.1.0-incubating release Ignite has a so called TcpDiscoveryCloudIpFinder that supports a variety of cloud providers out of the box. Actually, under the hood this IP finder is integrated with well-known Apache jclouds multi-cloud toolkit. Using jclouds the IP finder retrieves IP addresses of all virtual machines in a cloud, talks to them and forms a list of active Ignite nodes (the machines with running Ignite instances). Every node stores a copy of such an up-to-date list. All this lets the nodes to discover each other automatically.
Having this in mind, let's set up and use TcpDiscoveryCloudIpFinder. As an example I'll keep using Google Compute Engine platform but you can use any provider from this list.
First three parameters that are passed to the instance of the IP finder in the code above are set according to jclouds requirements:
Well, Apache Ignite has Compute Engine specific solution to fill this gap but what's about many others cloud platforms? What if I want to use AWS, Rackspace, GoGrid or other cloud provider?
Do you need to switch back to annoying and fragile static IP configuration? Luckily, the answer - you don't!
Since 1.1.0-incubating release Ignite has a so called TcpDiscoveryCloudIpFinder that supports a variety of cloud providers out of the box. Actually, under the hood this IP finder is integrated with well-known Apache jclouds multi-cloud toolkit. Using jclouds the IP finder retrieves IP addresses of all virtual machines in a cloud, talks to them and forms a list of active Ignite nodes (the machines with running Ignite instances). Every node stores a copy of such an up-to-date list. All this lets the nodes to discover each other automatically.
Having this in mind, let's set up and use TcpDiscoveryCloudIpFinder. As an example I'll keep using Google Compute Engine platform but you can use any provider from this list.
TcpDiscoverySpi spi = new TcpDiscoverySpi(); TcpDiscoveryCloudIpFinder ipFinder = new TcpDiscoveryCloudIpFinder(); // Configuration for Google Compute Engine. ipFinder.setProvider("google-compute-engine"); ipFinder.setIdentity(yourServiceAccountEmail); ipFinder.setCredential(pathToYourPemFile); ipFinder.setZones(Arrays.asList("us-central1-a", "asia-east1-a")); spi.setIpFinder(ipFinder); IgniteConfiguration cfg = new IgniteConfiguration(); // Override default discovery SPI. cfg.setDiscoverySpi(spi); // Start Ignite node. Ignition.start(cfg);
First three parameters that are passed to the instance of the IP finder in the code above are set according to jclouds requirements:
- Provider name is equal to a value stored in "Maven Artifact ID" column of the following table. Compute Engine's value is "google-compute-engine", that's why it's passed to ipFinder.setProvider();
- Both identity and credential are provider specific. To get a provider specific instructions click on a provider name in "Provider" column in the same table. Google Compute authentication method is an exception, it's authentication method is covered on this page.
The last parameter (zones) that is set for the IP finder is optional. However, I highly recommend not to ignore it if it's possible for your case. The reason is simple. If zones are not set then TcpDiscoveryCloudIpFinder will check every zone, that a provider has, looking for Ignite nodes. This can drop the performance significantly.
In case of my example you can easily form a zones' list by going to Google Developer Console and checking where your VMs are located. This simple step can improve your performance many times.
When you finished with the parameters, enable Google Compute Engine API in Google Developer Console and benefit from this new IP finder!
Trace the location of an IP address with WebmasterToys IP Locator
ReplyDelete