当我尝试使用
连接本地群集时ClientConfig clientConfig = new ClientConfig();
ClientNetworkConfig cnc = clientConfig.getNetworkConfig();
cnc.addAddress("127.0.0.1:5701");
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
这很好用。
但是通过连接到外部地址,我收到10.0.0.1:5701
的方式
Exception in thread "main" java.lang.IllegalStateException: Unable to connect to any address in the config! The following addresses were tried:[/10.0.0.1:5701]
at com.hazelcast.client.spi.impl.ClusterListenerSupport.connectToCluster(ClusterListenerSupport.java:174)
at com.hazelcast.client.spi.impl.ClientClusterServiceImpl.start(ClientClusterServiceImpl.java:191)
如何设置HazelcastClient以连接IP 10.0.0.1
? (以编程方式或使用xml)
我已经看过Hazelcast: connecting to remote cluster,但我找不到如何以编程方式制作
答案 0 :(得分:0)
您是否尝试过对IP地址和端口进行telnet。如果telnet失败,那么如果要提供公共IP,则需要打开防火墙端口。
telnet ip port