I see. Do you have some kind of network address translation (NAT)
configured?

Address resolver should help, you are right.
You can specify *localPort and localAddress *properties of discovery SPI
according to address in your local network.
IP finder, on the other hand, should contain public addresses (or local, if
nodes share the same local network).
Address resolver should contain a mapping from local addresses to external
ones. If ports of local and external addresses differ, then address
resolver should contain ports as well. There is explanation and a few
examples in JavaDoc of *BasicAddressResolver*:
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/configuration/BasicAddressResolver.html

To normally operate, two ports should be available for connection: for
discovery and for communication SPI.
When connected by discovery, node will send data about its communication
addresses, including bound and external ones. External address is resolved,
using configured AddressResolver.

So make sure, that all addresses for all ports are configured in
*AddressResolver*. Looks like your *AddressResolver *is missing
configuration for communication ports.

Denis

вт, 28 нояб. 2017 г. в 10:42, Josephine Barboza <[email protected]
>:

> It is not possible to start the communication/discovery service on public
> ip. I get a BindException: Cannot assign requested address whenever I do
> that. Therefore, I was starting the services on Private IPs.
>
>
>
> *From:* Denis Mekhanikov [mailto:[email protected]]
>
> *Sent:* Monday, November 27, 2017 10:04 PM
>
>
> *To:* [email protected]
> *Subject:* Re: Node unable to join cluster
>
>
>
> Sorry, I still don't understand, why you need an AddressResolver.
>
> Can't you specify all external IPs in configuration and don't use internal
> ones?
>
>
>
> Denis
>
>
>
> пн, 27 нояб. 2017 г. в 15:55, Josephine Barboza <
> [email protected]>:
>
> Hi Denis,
>
>
>
> I was able to establish connection between the two nodes. The problem was
> that in AddressReslover the internal-external address mapping was
> incorrect. I had to specify the socketAddress instead of the address as the
> internal address for it to work.
>
> addrs=[10.131.12.16], sockAddrs=[/10.131.12.16:1510]
>
>
>
> However after the nodes have started they both seem to be stuck. I believe
> the problem is that TcpCommunicationSpi is not starting on the IP Address
> and port I have configured. Please see the logs below. How do I change
> this? I have set the localhost on IgniteConfig as 10.105.244.17
>
>
>
> Node 2:
>
> 2017-11-27 10:35:55  [exchange-worker-#28%nvIDNGB1%] WARN
> TcpCommunicationSpi:471 - Connect timed out (consider increasing
> 'failureDetectionTimeout' configuration property) [addr=/10.131.12.16:1511,
> failureDetectionTimeout=10000]
>
> 2017-11-27 10:35:55  [grid-nio-worker-tcp-comm-0-#17%nvIDNGB1%] INFO
> TcpCommunicationSpi:463 - Established outgoing communication connection
> [locAddr=/10.105.244.16:47214, rmtAddr=/205.139.17.146:1511]
>
>
>
> Thanks.
>
>
>
> *From:* Denis Mekhanikov [mailto:[email protected]]
>
> *Sent:* Thursday, November 23, 2017 7:13 PM
> *To:* [email protected]
>
>
> *Subject:* Re: Node unable to join cluster
>
>
>
> Josephine,
>
>
>
> You should specify addresses in IP finder together with ports. So, it
> should be like that:
>
> String[] addresses = {“ 206.142.241.45:1510”};
>
> Then discovery SPI will be able to find itself, and the node will start.
>
>
>
> Do you have nodes in your cluster, that are able to see each other
> locally? If not, then you don't need an address resolver actually.
>
>
>
> Denis
>
>
>
> чт, 23 нояб. 2017 г. в 13:10, Josephine Barboza <
> [email protected]>:
>
> Hi,
>
>
>
> Still getting this error.
>
> 2017-11-23 08:59:27  [tcp-disco-msg-worker-#3%nvIDNGB1%] ERROR
> TcpDiscoverySpi:495 - Failed to connect to next node
> [msg=TcpDiscoveryNodeAddedMessage [node=TcpDiscoveryNode
> [id=a11e7f8b-6d64-4620-a296-1a52fb253a48, addrs=[10.131.12.16], sockAddrs=[/
> 10.131.12.16:1510], discPort=1510, order=0, intOrder=3,
> lastExchangeTime=1511427557675, loc=false,
> ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=false],
> dataPacket=o.a.i.spi.discovery.tcp.internal.DiscoveryDataPacket@516aef1f,
> discardMsgId=null, discardCustomMsgId=null, top=null, clientTop=null,
> gridStartTime=1511427411342, super=TcpDiscoveryAbstractMessage
> [sndNodeId=null, id=5470818ef51-36f0e1f5-fe2e-4b2c-9f9d-bdd4f95f6cb0,
> verifierNodeId=36f0e1f5-fe2e-4b2c-9f9d-bdd4f95f6cb0, topVer=0,
> pendingIdx=0, failedNodes=null, isClient=false]], err=connect timed out]
>
> java.net.SocketTimeoutException: connect timed out
>
>
>
> it looks like the node1  is trying to connect on private Iof node2P. If I
> give Public IP as discovery Local Address nodes won’t start. Could someone
> help me understand what should be the configuration when public and private
> IPs are involved? I have created the below address resolver configuration
>
>
>
> *package* com.hm.ignite.repositories;
>
>
>
> *import* java.net.InetSocketAddress;
>
> *import* java.util.Collection;
>
> *import* java.util.HashMap;
>
> *import* java.util.List;
>
> *import* java.util.Map;
>
>
>
> *import* org.apache.ignite.IgniteCheckedException;
>
> *import* org.apache.ignite.configuration.AddressResolver;
>
> *import* org.apache.ignite.internal.util.typedef.F;
>
>
>
> *public* *class* AddressResolverImpl *implements* AddressResolver {
>
>     /** Internal address on external address. */
>
>     *private* *static* Map<InetSocketAddress, List<InetSocketAddress>>
> *maps* = *new* HashMap<>();
>
>
>
>     *static* {
>
>         *maps*.put(*new* InetSocketAddress("206.142.241.45", 47500), F.
> *asList*(*new* InetSocketAddress("10.105.244.17", 31183)));
>
>         *maps*.put(*new* InetSocketAddress("205.139.17.146", 47500), F.
> *asList*(*new* InetSocketAddress("10.131.12.16", 30112)));
>
>         *maps*.put(*new* InetSocketAddress("10.105.244.17", 47500), F.
> *asList*(*new* InetSocketAddress("206.142.241.45", 31183)));
>
>         *maps*.put(*new* InetSocketAddress("10.131.12.16", 47500), F.
> *asList*(*new* InetSocketAddress("205.139.17.146", 30112)));
>
>     }
>
>
>
>     /** {@inheritDoc} */
>
>     @Override *public* Collection<InetSocketAddress>
> getExternalAddresses(InetSocketAddress addr)
>
>         *throws* IgniteCheckedException {
>
>         *return* *maps*.get(addr);
>
>     }
>
> }
>
>
>
>
>
> *From:* Josephine Barboza
> *Sent:* Wednesday, November 22, 2017 5:13 PM
> *To:* [email protected]
> *Subject:* RE: Node unable to join cluster
>
>
>
> Hi Denis,
>
>
>
> After adding the localAddress in TcpDiscoverySpi, the node is still not
> starting. It fails with the below log messages
>
>
>
> 2017-11-22 11:25:36  [localhost-startStop-1] DEBUG TcpDiscoverySpi:452 -
> Handshake response from local node: TcpDiscoveryHandshakeResponse [order=0,
> super=TcpDiscoveryAbstractMessage [sndNodeId=null,
> id=089b073ef51-41a2ab42-639c-48f0-ad36-b75cd625939a, verifierNodeId=null,
> topVer=0, pendingIdx=0, failedNodes=null, isClient=false]]
>
> 2017-11-22 11:25:36  [localhost-startStop-1] DEBUG TcpDiscoverySpi:452 -
> Failed to send join request message [addr=/206.142.241.45:1510,
> msg=Failed to send message to address [addr=/206.142.241.45:1510,
> msg=TcpDiscoveryJoinRequestMessage [node=TcpDiscoveryNode
> [id=41a2ab42-639c-48f0-ad36-b75cd625939a, addrs=[0:0:0:0:0:0:0:1%lo,
> 10.105.244.16, 10.105.244.17, 127.0.0.1], sockAddrs=[/10.105.244.17:1510,
> /0:0:0:0:0:0:0:1%lo:1510, /10.105.244.16:1510, /127.0.0.1:1510],
> discPort=1510, order=0, intOrder=0, lastExchangeTime=1511349337034,
> loc=true, ver=2.1.0#20170720-sha1:a6ca5c8a, isClient=false],
> dataPacket=org.apache.ignite.spi.discovery.tcp.internal.DiscoveryDataPacket@432a7606,
> super=TcpDiscoveryAbstractMessage [sndNodeId=null,
> id=343b073ef51-41a2ab42-639c-48f0-ad36-b75cd625939a, verifierNodeId=null,
> topVer=0, pendingIdx=0, failedNodes=null, isClient=false]]]]
>
>
>
>
>
> Below is my configuration
>
>
>
>
>
>           // Comm spi
>
>           TcpCommunicationSpi commSpi = *new* TcpCommunicationSpi();
>
>           commSpi.setLocalPort(1511);
>
>           commSpi.setLocalPortRange(1);
>
>           commSpi.setName(“commSpi”);
>
>           igniteCfg.setCommunicationSpi(commSpi);
>
>           igniteCfg.setNetworkTimeout(20000);
>
>
>
>     // IP Finder
>
>           TcpDiscoveryVmIpFinder ipFinder = *new*
> TcpDiscoveryVmIpFinder();
>
>           String[] addresses = {“ 206.142.241.45”}; // This is the public
> IP of my VM which has two ports open 1510 and 1511
>
>           ipFinder.setAddresses(addresses);
>
>
>
>
>
>           // Discovery SPI
>
>     TcpDiscoverySpi discoverySpi = *new* TcpDiscoverySpi();
>
>           discoverySpi.setLocalPort(1510);
>
>           discoverySpi.setLocalPortRange(1);
>
>           discoverySpi.setIpFinder(ipFinder);
>
>           discoverySpi.setNetworkTimeout(20000);
>
>           discoverySpi.setName(“discoSpi”);
>
>           discoverySpi.setLocalAddress(“206.142.241.45”);
>
>
>
>
>
>           // Address Resolver
>
>           Map<String, String> addrMap = new Hashmap<>();
>
>           addrMap.put(“10.105.244.17”, “206.142.241.45”);
>
>
>
>     AddressResolver addrResolvr = *new* BasicAddressResolver(addrMap);
>
>           discoverySpi.setAddressResolver(addrResolvr);
>
>
>
>           igniteCfg.setDiscoverySpi(discoverySpi);
>
>
>
>
>
> I am still unable to start a local node if I use the public IP in IPFinder.
>
> What could be the issue here?
>
>
>
>
>
> *From:* Denis Mekhanikov [mailto:[email protected]
> <[email protected]>]
> *Sent:* Tuesday, November 21, 2017 6:15 PM
> *To:* [email protected]
> *Subject:* Re: Node unable to join cluster
>
>
>
> Hi Josephine!
>
>
>
> Make sure, that TcpDiscoveryVmIpFinder has address of the local node on
> the list.
>
> Otherwise the first node won't be able to start, because discovery SPI
> won't find any nodes.
>
>
>
> Also note, that TcpDiscoverySpi has localAddress and localPort properties.
> Try setting them according to your public IP and port.
>
>
>
> Refer to this page for more information:
> https://apacheignite.readme.io/docs/cluster-config
>
>
>
> Denis
>
>
>
> вт, 21 нояб. 2017 г. в 15:11, Josephine Barboza <
> [email protected]>:
>
> Hi,
>
>
>
> I have setup ignite instances on two different VMs and I’m trying to
> create a cluster using Static IP discovery using TcpDiscoveryVmIpFinder.
>
> I have a couple of questions:
>
>    1. Do I need to give loopback address or public IP for the node to
>    start before trying to connect to the other node in the cluster? What is
>    the recommended configuration for production?
>    2. When I give loopback address/private IP it works(node starts before
>    trying the connect to other node) but when I give the public IP it does
>    not. Both the ports for discoverySpi and commSpi are open on the public IP
>    and I have used address resolver as well to map the private IP to the
>    public IP. Is there any other configuration required?
>    3. Facing the same issue as mentioned in point 2 while connecting to
>    the node on the second VM where in spite of using address resolver the node
>    is unable to join the topology.
>
>
>
> Thanks.
>
>
>
> *IMPORTANT NOTICE: This email and any files transmitted with it are
> confidential and intended solely for the use of the individual or entity to
> whom they are addressed. If you have received this email in error, please
> notify the system manager and/or the sender immediately.*
>
>

Reply via email to