General Questions

Expand all | Collapse all

Failing to connect AWS Ignite Cluster

Jump to Best Answer
  • 1.  Failing to connect AWS Ignite Cluster

    Posted 10-16-2019 02:10 PM
    Edited by sri tummala 10-17-2019 09:21 AM
    Hi Community, 

    Answer:-
    ok I found the answer I have to connect to port 10800 which is thin client example code is below

    package com.ignite.examples.igniteStartup

    import org.apache.ignite.Ignite
    import org.apache.ignite.IgniteCache
    import org.apache.ignite.Ignition
    import org.apache.ignite.configuration.{ClientConfiguration, IgniteConfiguration}
    import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
    import org.apache.ignite.configuration.IgniteConfiguration
    import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
    import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
    import java.util.Arrays
    import java.util.List
    import com.ignite.examples.model.Address
    import org.apache.ignite.client.{ClientCache, IgniteClient}
    import scala.collection.JavaConversions._

    object IgniteClientConnection {
    def main(args: Array[String]): Unit = {

    System.out.println()
    System.out.println(">>> Thin client put-get example started.")
    System.out.println(">>> I am here.")

    val cfg2 = new ClientConfiguration().setAddresses("3.88.248.113:10800")
    val igniteClient:IgniteClient = Ignition.startClient(cfg2)
    val CACHE_NAME = "put-get-example";
    val cache:ClientCache[Integer, Address] = igniteClient.getOrCreateCache(CACHE_NAME)

    System.out.format(">>> Created cache [%s].\n", CACHE_NAME)

    val key = 1
    val address:Address = new Address("1545 Jackson Street", 94612)

    cache.put(key, address)

    System.out.format(">>> Saved [%s] in the cache.\n", address)

    val cachedVal:Address = cache.get(key)

    System.out.format(">>> Loaded [%s] from the cache.\n", cachedVal)




    }

    }




    I created a ignite cluster by following steps mentioned here (https://www.gridgain.com/docs/8.7.6//installation-guide/manual-install-on-ec2) , I successfully created the cluster but now when I am trying to connect from my local PC I am unable to connect the cluster or ignite node.

    I used default.xml file which has the following content I tried all possibilities of IP address range and host ip addresses.

    Error:-
    Failed to connect to any address from IP finder (will retry to join topology every 2000 ms; change 'reconnectDelay' to configure the frequency of retries):

    Security Config of Ec2

    Code which I am using to connect 

    package com.ignite.examples.igniteStartup

    import org.apache.ignite.IgniteException
    import org.apache.ignite.Ignition

    object ExampleNodeStartup {

    def main(args: Array[String]): Unit = {
    Ignition.start("/Users/kalit_000/Downloads/designing-event-driven-applications-apache-kafka-ecosystem/05/demos/kafka-streams-after/ApacheIgnitePoc/src/main/scala/com/ignite/examples/config/example-ignite.xml")
    }

    }

    package com.ignite.examples.igniteStartup

    import org.apache.ignite.Ignite
    import org.apache.ignite.IgniteCache
    import org.apache.ignite.Ignition
    import org.apache.ignite.configuration.IgniteConfiguration
    import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
    import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
    import org.apache.ignite.configuration.IgniteConfiguration
    import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
    import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
    import java.util.Arrays
    import java.util.List
    import scala.collection.JavaConversions._

    object IgniteClientConnection {
    def main(args: Array[String]): Unit = {

    val spi = new TcpDiscoverySpi
    val ipFinder = new TcpDiscoveryVmIpFinder
    val hostList: List[String] = Arrays.asList(("ec2-100-25-173-220:47500..47509," +
    "ec2-100-25-173-220.compute-1.amazonaws.com:47500..47509," +
    "3.86.250.240:47500..47509," +
    "172.31.81.211:47500..47509," +
    "100.25.173.220:47500..47509").split(","): _*)

    ipFinder.setAddresses(hostList)
    spi.setIpFinder(ipFinder)
    val cfg = new IgniteConfiguration
    cfg.setDiscoverySpi(spi)
    cfg.setClientMode(true)
    cfg.setPeerClassLoadingEnabled(true)

    val ignite: Ignite = Ignition.start(cfg)
    Ignition.ignite().cache("test")
    //LOG.info(">>> cache acquired")


    }

    }



    <?xml version="1.0" encoding="UTF-8"?>

    <!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements. See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    -->

    <!--
    Ignite configuration with all defaults and enabled p2p deployment and enabled events.
    -->
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/util
    http://www.springframework.org/schema/util/spring-util.xsd">
    <bean abstract="true" id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
    <!-- Set to true to enable distributed class loading for examples, default is false. -->
    <property name="peerClassLoadingEnabled" value="true"/>

    <!-- Enable task execution events for examples. -->
    <property name="includeEventTypes">
    <list>
    <!--Task execution events-->
    <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
    <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
    <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
    <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
    <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
    <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>

    <!--Cache events-->
    <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
    <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
    <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
    </list>
    </property>

    <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
    <property name="discoverySpi">
    <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
    <property name="ipFinder">
    <!--
    Ignite provides several options for automatic discovery that can be used
    instead os static IP based discovery. For information on all options refer
    to our documentation: http://apacheignite.readme.io/docs/cluster-config
    -->
    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
    <!-- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder"> -->
    <property name="addresses">
    <list>
    <!-- In distributed environment, replace with actual host IP address. -->
    <value>ec2-100-25-173-220:47500..47509</value>
    <value>ec2-100-25-173-220.compute-1.amazonaws.com:47500..47509</value>
    <value>3.86.250.240:47500..47509</value>
    <value>172.31.81.211:47500..47509</value>
    <value>100.25.173.220:47500..47509</value>
    </list>
    </property>
    </bean>
    </property>
    </bean>
    </property>
    </bean>
    </beans>



    Thanks
    Sri

    ------------------------------
    sri tummala
    ------------------------------


  • 2.  RE: Failing to connect AWS Ignite Cluster
    Best Answer

    Posted 10-17-2019 03:05 AM
    Hello!

    EC2 has internal and external addresses, so this will likely not work. We do not recommend joining non-collocated client nodes to cluster. Please use thin client (such as JDBC, REST or Java IgniteClient) to communicate with your AWS cluster.

    Regards,

    ------------------------------
    Ilya Kasnacheev
    Community Support Specialist
    GridGain
    ------------------------------



  • 3.  RE: Failing to connect AWS Ignite Cluster

     
    Posted 10-18-2019 03:56 PM
    Hello Kali,

    If you'd like to access the AWS environment from outside (like your laptop) then assign external/public addresses/hostnames for your AWS nodes and pass those IPs/names into the TcpIpFinder configuration.

    ------------------------------
    Denis
    ------------------------------



Would you attend a July Meetup?


Announcements