public class BasicAddressResolver extends Object implements AddressResolver
Allows to provide simple mapping between different address, which is useful different parts of the cluster are located in different subnetworks and port forwarding on the router is used for communication between them. Another common case is Docker environment which can create a pair of public and private address per container.
There are two different types of mapping supported by this implementation of
First type maps specific socket addresses (host and port pairs) are mapped to each other. This is useful for port forwarding, where multiple nodes will typically map to the same external address (router), but with different port numbers. Here is the example:
<property name="addressResolver"> <bean class="org.apache.ignite.configuration.BasicAddressResolver"> <constructor-arg> <map> <entry key="10.0.0.1:47100" value="18.104.22.168:1111"/> <entry key="10.0.0.2:47100" value="22.214.171.124:2222"/> <entry key="10.0.0.3:47100" value="126.96.36.199:3333"/> </map> </constructor-arg> </bean> </property>
Second type maps one host to another. In this case any internal address a node is bound to will be mapped to the corresponding external host with the same host number. Here is the example:
<property name="addressResolver"> <bean class="org.apache.ignite.configuration.BasicAddressResolver"> <constructor-arg> <map> <entry key="10.0.0.1" value="188.8.131.52"/> </map> </constructor-arg> </bean> </property>Here any port on
10.0.0.1will be mapped to the same port number on
10.0.0.1:47100will be mapped to
10.0.0.1:47500will be mapped to
Two types of mappings described above can be mixed within one address resolver.
|Constructor and Description|
Created the address resolver.
|Modifier and Type||Method and Description|
Maps internal address to a collection of external addresses.
public Collection<InetSocketAddress> getExternalAddresses(InetSocketAddress addr) throws IgniteCheckedException
addr- Internal (local) address.
IgniteCheckedException- Thrown if any exception occurs.