我想知道在apache点火中是否存在AddressResolver接口的示例用法。
我试图绑定'我的本地IP地址(例如192.168.10.101)使用AddressResolver接口到我的外部IP地址,但没有运气。
当我这样做时,Ignite服务器只是挂起(也没有来自调试的输出)
启动服务器的代码是:
TcpDiscoverySpi spi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(ipaddresses);
spi.setIpFinder(ipFinder);
spi.setAddressResolver(new IotAddressResolver());
IgniteConfiguration cfg = new IgniteConfiguration();
// Override default discovery SPI.
cfg.setDiscoverySpi(spi);
System.setProperty("IGNITE_QUIET", "false");
// Start Ignite node.
ignite = Ignition.start(cfg);
我对AddressResolver的实现是:
public class IotAddressResolver implements AddressResolver {
@Override
public Collection<InetSocketAddress> getExternalAddresses(
InetSocketAddress internalAddresses) throws IgniteCheckedException {
String host = "XX.XX.XX.XX";
Collection<InetSocketAddress> result = new ArrayList<InetSocketAddress>();
result.add(new InetSocketAddress(host, internalAddresses.getPort()));
return result;
}
}
点燃调试日志的最后一行是:
WARNING: Timed out waiting for message to be read (most probably, the reason is in long GC pauses on remote node) [curTimeout=9989]
我将不胜感激任何帮助。谢谢
答案 0 :(得分:1)
您是否可以在地址解析器的帮助下提供有关部署的更多详细信息以及您尝试实现的目标?您有多少个物理主机和Ignite节点?它们是否位于不同的网络中,并且它们之间有路由器?
答案 1 :(得分:0)
我不知道这是否是处理此问题的最佳方法,但我设法将igntie作为本地服务器启动。我正在设置我的本地IP和端口:
System.setProperty("IGNITE_QUIET", "false");
TcpDiscoverySpi spi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
// Set initial IP addresses.
ipFinder.setAddresses(ipaddresses);
spi.setIpFinder(ipFinder);
// Override local port.
commSpi.setLocalPort(47501);
commSpi.setLocalAddress("XX.XX.XX.XX");
commSpi.setLocalPortRange(50);
IgniteConfiguration cfg = new IgniteConfiguration();
// Override default communication SPI.
cfg.setCommunicationSpi(commSpi);
cfg.setDiscoverySpi(spi);
cfg.setAddressResolver(new IotAddressResolver());
cfg.setClientMode(true);
// Start Ignite node
ignite = Ignition.start(cfg);
XX.XX.XX.XX是我的本地IP地址