我按照博客(https://www.gridgain.com/docs/8.7.6//installation-guide/manual-install-on-ec2)中的步骤在AWS中创建了ignite集群,现在我正尝试使用无法连接的本地PC上的Java客户端进行连接。 不知道为什么我无法连接。
错误:-
Exception in thread "main" org.apache.ignite.client.ClientConnectionException: Ignite cluster is unavailable
Caused by: java.net.ConnectException: Connection refused (Connection refused)
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.")
val spi = new TcpDiscoverySpi
val ipFinder = new TcpDiscoveryVmIpFinder
val hostList: List[String] = Arrays.asList(("ec2-100-25-173-220:47100..47600," +
"ec2-100-25-173-220.compute-1.amazonaws.com:47100..47600," +
"3.86.250.240:47100..47600," +
"172.31.81.211:47100..47600," +
"100.25.173.220:47100..47600").split(","): _*)
System.out.println(">>> I am here.")
val cfg2 = new ClientConfiguration().setAddresses("100.25.173.220:47100..47700")
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)
//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")
}
}
谢谢 斯里
答案 0 :(得分:1)
您将以下端口指定为Java瘦客户端的端点:47100..47700
,但是默认情况下,瘦客户端通过端口10800
工作。
将端口更改为正确的端口,并确保它在AWS上已打开。