Class BasicAddressResolver

  • All Implemented Interfaces:
    AddressResolver

    public class BasicAddressResolver
    extends Object
    implements AddressResolver
    Basic implementation of 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 AddressResolver.

    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="123.123.123.123:1111"/>
                     <entry key="10.0.0.2:47100" value="123.123.123.123:2222"/>
                     <entry key="10.0.0.3:47100" value="123.123.123.123: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="123.123.123.123"/>
                 </map>
             </constructor-arg>
         </bean>
     </property>
     
    Here any port on 10.0.0.1 will be mapped to the same port number on 123.123.123.123. E.g., 10.0.0.1:47100 will be mapped to 123.123.123.123:47100, and 10.0.0.1:47500 will be mapped to 123.123.123.123:47500.

    Two types of mappings described above can be mixed within one address resolver.