我想知道在apache點火器中是否存在AddressResolver接口的示例用法。AddressResolver接口的正確用法
我試圖使用AddressResolver接口將我的本地IP地址(例如192.168.10.101)綁定到我的外部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]
我會很感激任何幫助。謝謝
在細節 - 我有部署在一個VPS 2個服務器節點,這是工作正確。 –
我想使用地址解析器,以便能夠在本地機器上以客戶端模式運行Ignite,因此我可以在VPS上運行的節點上運行測試。我的本地機器在本地網絡上運行,只有一個公用IP地址用於整個網絡。我在路由器中使用端口轉發,以便能夠將數據包正確「路由」到本地計算機。 –
同樣在我的應用程序屬性中,addesses字段是:ipaddresses = XX.XX.XX.XX:47501..47510,其中XX.XX.XX.XX是我本地網絡的公共地址 –