我在阿里云的一台centos上部署了一个ElasticSearch 5.4.3 集群,在另外一台centos(非局域网)上也部署并启动了一个节点,但是ElasticSearch 5.4.3 单播无法自动发现 这是我的配置: (集群配置 -- 1) (IP:47.93.232.185) cluster.name: cluster_test node.name: local_1 bootstrap.memory_lock: true network.host: 0.0.0.0 http.port: 9201 transport.tcp.port: 9301 http.enabled: yes discovery.zen.minimum_master_nodes: 1 discovery.zen.fd.ping_timeout: 120s discovery.zen.fd.ping_retries: 6 discovery.zen.fd.ping_interval: 20s discovery.zen.ping.unicast.hosts: ["47.93.232.185:9301", "47.93.232.185:9302", "119.23.224.26:9300"] (集群配置 -- 2) (IP:47.93.232.185) cluster.name: cluster_test node.name: local_2 bootstrap.memory_lock: true network.host: 0.0.0.0 http.port: 9202 transport.tcp.port: 9302 http.enabled: yes discovery.zen.minimum_master_nodes: 1 discovery.zen.fd.ping_timeout: 120s discovery.zen.fd.ping_retries: 6 discovery.zen.fd.ping_interval: 20s discovery.zen.ping.unicast.hosts: ["47.93.232.185:9301", "47.93.232.185:9302", "119.23.224.26:9300"] (新节点配置 -- 1) (IP:119.23.224.26) cluster.name: cluster_test node.name: my_aliyun_1 bootstrap.memory_lock: true network.host: 0.0.0.0 http.port: 9201 transport.tcp.port: 9301 http.enabled: yes discovery.zen.minimum_master_nodes: 1 discovery.zen.fd.ping_timeout: 120s discovery.zen.fd.ping_retries: 6 discovery.zen.fd.ping_interval: 20s discovery.zen.ping.unicast.hosts: ["47.93.232.185:9301", "47.93.232.185:9302", "119.23.224.26:9300"] 新节点启动后报错: [2017-08-11T11:30:49,480][INFO ][o.e.n.Node ] [my_aliyun_1] initializing ... [2017-08-11T11:30:49,582][INFO ][o.e.e.NodeEnvironment ] [my_aliyun_1] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [34.1gb], net total_space [39.2gb], spins? [unknown], types [rootfs] [2017-08-11T11:30:49,583][INFO ][o.e.e.NodeEnvironment ] [my_aliyun_1] heap size [247.6mb], compressed ordinary object pointers [true] [2017-08-11T11:30:49,583][INFO ][o.e.n.Node ] [my_aliyun_1] node name [my_aliyun_1], node ID [z5-yV40eR5SV5htXiSjYCg] [2017-08-11T11:30:49,584][INFO ][o.e.n.Node ] [my_aliyun_1] version[5.4.3], pid[11138], build[eed30a8/2017-06-22T00:34:03.743Z], OS[Linux/3.10.0-514.26.2.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_141/25.141-b16] [2017-08-11T11:30:49,584][INFO ][o.e.n.Node ] [my_aliyun_1] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Xms256m, -Xmx256m, -Des.path.home=/usr/elasticsearch/es9300] [2017-08-11T11:30:51,007][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded module [aggs-matrix-stats] [2017-08-11T11:30:51,007][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded module [ingest-common] [2017-08-11T11:30:51,007][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded module [lang-expression] [2017-08-11T11:30:51,007][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded module [lang-groovy] [2017-08-11T11:30:51,008][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded module [lang-mustache] [2017-08-11T11:30:51,008][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded module [lang-painless] [2017-08-11T11:30:51,008][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded module [percolator] [2017-08-11T11:30:51,008][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded module [reindex] [2017-08-11T11:30:51,008][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded module [transport-netty3] [2017-08-11T11:30:51,008][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded module [transport-netty4] [2017-08-11T11:30:51,008][INFO ][o.e.p.PluginsService ] [my_aliyun_1] loaded plugin [analysis-ik] [2017-08-11T11:30:53,588][INFO ][o.e.d.DiscoveryModule ] [my_aliyun_1] using discovery type [zen] [2017-08-11T11:30:54,458][INFO ][o.e.n.Node ] [my_aliyun_1] initialized [2017-08-11T11:30:54,458][INFO ][o.e.n.Node ] [my_aliyun_1] starting ... [2017-08-11T11:30:54,742][INFO ][o.e.t.TransportService ] [my_aliyun_1] publish_address {172.18.35.30:9300}, bound_addresses {0.0.0.0:9300} [2017-08-11T11:30:54,748][INFO ][o.e.b.BootstrapChecks ] [my_aliyun_1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks [2017-08-11T11:31:24,803][WARN ][o.e.n.Node ] [my_aliyun_1] timed out while waiting for initial discovery state - timeout: 30s [2017-08-11T11:31:24,820][INFO ][o.e.h.n.Netty4HttpServerTransport] [my_aliyun_1] publish_address {172.18.35.30:9200}, bound_addresses {0.0.0.0:9200} [2017-08-11T11:31:24,822][INFO ][o.e.n.Node ] [my_aliyun_1] started [2017-08-11T11:31:27,901][WARN ][o.e.d.z.ZenDiscovery ] [my_aliyun_1] failed to connect to master [{local_2}{hoPvvXU3RsSqaRmyMewPoA}{Ui3uD_keQmaYbv7T1qs_vA}{172.17.129.126}{172.17.129.126:9302}], retrying... org.elasticsearch.transport.ConnectTransportException: [local_2][172.17.129.126:9302] connect_timeout[30s] at org.elasticsearch.transport.netty4.Netty4Transport.connectToChannels(Netty4Transport.java:361) ~[?:?] at org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:549) ~[elasticsearch-5.4.3.jar:5.4.3] at org.elasticsearch.transport.TcpTransport.connectToNode(TcpTransport.java:473) ~[elasticsearch-5.4.3.jar:5.4.3] at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:315) ~[elasticsearch-5.4.3.jar:5.4.3] at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:302) ~[elasticsearch-5.4.3.jar:5.4.3] at org.elasticsearch.discovery.zen.ZenDiscovery.joinElectedMaster(ZenDiscovery.java:468) [elasticsearch-5.4.3.jar:5.4.3] at org.elasticsearch.discovery.zen.ZenDiscovery.innerJoinCluster(ZenDiscovery.java:420) [elasticsearch-5.4.3.jar:5.4.3] at org.elasticsearch.discovery.zen.ZenDiscovery.access$4100(ZenDiscovery.java:83) [elasticsearch-5.4.3.jar:5.4.3] at org.elasticsearch.discovery.zen.ZenDiscovery$JoinThreadControl$1.run(ZenDiscovery.java:1197) [elasticsearch-5.4.3.jar:5.4.3] at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:569) [elasticsearch-5.4.3.jar:5.4.3] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141] Caused by: io.netty.channel.ConnectTimeoutException: connection timed out: 172.17.129.126/172.17.129.126:9302 at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:267) ~[?:?] at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38) ~[?:?] at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:120) ~[?:?] at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[?:?] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) ~[?:?] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462) ~[?:?] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) ~[?:?] ... 1 more 出现错误的地方主要有: 1、 [2017-08-11T11:31:27,901][WARN ][o.e.d.z.ZenDiscovery ] [my_aliyun_1] failed to connect to master [{local_2}{hoPvvXU3RsSqaRmyMewPoA}{Ui3uD_keQmaYbv7T1qs_vA}{172.17.129.126}{172.17.129.126:9302}], retrying... org.elasticsearch.transport.ConnectTransportException: [local_2][172.17.129.126:9302] connect_timeout[30s] 2、 Caused by: io.netty.channel.ConnectTimeoutException: connection timed out: 172.17.129.126/172.17.129.126:9302 疑问:(非局域网)新节点my_aliyun_1启动后获取配置 discovery.zen.ping.unicast.hosts: ["47.93.232.185:9301", "47.93.232.185:9302", "119.23.224.26:9300"] 初始化ElasticSearch集群, 连接集群的时候却报错了[my_aliyun_1] failed to connect to master [{local_2},明显my_aliyun_1已经知道了集群中master节点为local_2,但是为什么会connect_timeout[30s], -- 配置-------------------------------- -- discovery.zen.fd.ping_timeout: 120s -- discovery.zen.fd.ping_retries: 6 -- discovery.zen.fd.ping_interval: 20s 就是新节点 my_aliyun_1 知道了集群中master节点,但是却连接超时,我在自己的windows上部署新节点后报错一样,连接超时, 阿里云的控制台安全组中我开放了入端口(9100 - 9900)和出端口(9100 - 9900), 在本地使用elasticsearch Java api 的TransportClient 连接elasticsearch集群没有问题 在window的浏览器上也可以访问到elasticsearch集群 我阿里云的环境配置等一致,我猜是阿里云对于不同网段服务器的管理的问题,导致不同网段的端口无法互相访问, 但这是不符合道理的,阿里云怎么可能在这方面存在问题,所以我想应该是我的问题,可能是在服务器的配置上出了问题, 不同网段的端口无法互相访问,导致新节点无法加入elasticsearch集群。 我目前还是一个elasticsearch新手,实在是找不到解决办法了,在这里恳请各位技术牛人帮我解解疑惑,谢谢!
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。