我有一台服务器,其中有一个公共IP和私有IP,其上运行弹性搜索服务,私有IP为10.x.x.x
,公共IP为159.x.x.x
但此处抛出java.net.NoRouteToHostException: No route to host
异常是代码
val setting=ImmutableSettings.settingsBuilder();
//setting.put("network.host",host)
setting.put("path.home", ".")
setting.put("discovery.zen.ping.unicast.hosts",host);
setting.put("http.port",http_port)
setting.put("transport.tcp.port",tcp_port)
val node= nodeBuilder().clusterName(clusterName).client(true).settings(setting).node();
val client=node.client()
es.http.port="9200-9300"
es.tcp.port="9300-9400"
es.host="10.x.x.x" //giving the private ip
这里是stacktrace
expire [null], clean_interval [1m]
03:00:04.753 9024 [main] cache DEBUG - [Maynard Tiboldt] using size [-1] [-1b], expire [null]
03:00:04.772 9043 [main] meta DEBUG - [Maynard Tiboldt] using gateway.local.auto_import_dangled [YES], gateway.local.delete_timeout
[30s], with gateway.local.dangling_timeout [2h]
03:00:04.778 9049 [main] udp DEBUG - [Maynard Tiboldt] using enabled [false], host [null], port [9700-9800], bulk_actions [1000], b
ulk_size [5mb], flush_interval [5s], concurrent_requests [4]
03:00:04.784 9055 [main] node INFO - [Maynard Tiboldt] initialized
03:00:04.784 9055 [main] node INFO - [Maynard Tiboldt] starting ...
03:00:04.809 9080 [main] SelectorUtil DEBUG - Using select timeout of 500
03:00:04.810 9081 [main] SelectorUtil DEBUG - Epoll-bug workaround enabled = false
03:00:04.834 9105 [main] netty DEBUG - [Maynard Tiboldt] using profile[default], worker_count[4], port[9300-9400], bind_host[null], publish_host[null], compress[false], connect_timeout[30s], connections_per_node[2/3/6/1/1], receive_predictor[512kb->512kb]
03:00:04.879 9150 [main] netty DEBUG - [Maynard Tiboldt] Bound profile [default] to address [/0:0:0:0:0:0:0:0:9300]
03:00:04.886 9157 [main] transport INFO - [Maynard Tiboldt] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/10.17.0.8:9300]}
03:00:04.922 9193 [main] discovery INFO - [Maynard Tiboldt] myCluster/pYsg3lDZTcyxvDl671T04A
03:00:04.923 9194 [elasticsearch[Maynard Tiboldt][clusterService#updateTask][T#1]] service DEBUG - [Maynard Tiboldt] processing [initial_join]: execute
03:00:04.930 9201 [elasticsearch[Maynard Tiboldt][clusterService#updateTask][T#1]] service DEBUG - [Maynard Tiboldt] processing [initial_join]: took 6ms no change in cluster_state
03:00:05.141 9412 [elasticsearch[Maynard Tiboldt][[unicast_connect]][T#1]] netty DEBUG - [Maynard Tiboldt] connected to node [[#zen_unicast_1#][elasticsearch1.myserver.com][inet[/159.x.x.x:9300]]]
03:00:06.486 10757 [elasticsearch[Maynard Tiboldt][[unicast_connect]][T#2]] netty DEBUG - [Maynard Tiboldt] connected to node [[Maynard Tiboldt][pYsg3lDZTcyxvDl671T04A][elasticsearch1.myserver.com][inet[/10.17.0.8:9300]]{data=false, client=true}]
03:00:09.461 13732 [elasticsearch[Maynard Tiboldt][transport_client_boss][T#1]{New I/O boss #5}] netty WARN - [Maynard Tiboldt] exception caught on transport layer [[id: 0x4dfc0f6a]], closing connection
java.net.NoRouteToHostException: No route to host
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_66]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_66]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [hazelserver-assembly-1.0.jar:1.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_66]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_66]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_66]
03:00:09.463 13734 [elasticsearch[Maynard Tiboldt][transport_client_boss][T#1]{New I/O boss #5}] netty WARN - [Maynard Tiboldt] exception caught on transport layer [[id: 0x470656c3]], closing connection
java.net.NoRouteToHostException: No route to host
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_66]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_66]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [hazelserver-assembly-1.0.jar:1.0]
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [hazelserver-assembly-1.0.jar:1.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_66]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_66]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_66]
03:00:09.466 13737 [elasticsearch[Maynard Tiboldt][generic][T#2]] netty DEBUG - [Maynard Tiboldt] disconnecting from [[#zen_unicast_1#][elasticsearch1.myserver.com][inet[/159.x.x.x:9300]]] due to explicit disconnect call
03:00:09.467 13738 [elasticsearch[Maynard Tiboldt][generic][T#1]] zen DEBUG - [Maynard Tiboldt] filtered ping responses: (filter_client[true], filter_data[false]) {none}
03:00:09.476 13747 [elasticsearch[Maynard Tiboldt][[unicast_connect]][T#1]] netty DEBUG - [Maynard Tiboldt] connected to node [[#zen_unicast_1#][elasticsearch1.myserver.com][inet[/159.203.107.230:9300]]]
03:00:12.459 16730 [elasticsearch[Maynard Tiboldt][transport_client_boss][T#1]{New I/O boss #5}] netty WARN - [Maynard Tiboldt] exception caught on transport layer [[id: 0x665f3000]], closing connection
java.net.NoRouteToHostException: No route to host
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_66]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_66]
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152) [hazelserver-assembly-1.0.jar:1.0]
这里我无法看到日志中的私有IP 10.xxx我只能看到这个10.17.0.8:9300而且我不知道这个ip地址还有弹性搜索客户端代码和弹性服务器运行在同一个服务器,有人可以指出我正在做的错误