阿里云
发表主题 回复主题
  • 3247阅读
  • 4回复

[技术开发]阿里云ElasticSearch集群无法发现非局域网节点

级别: 新人
发帖
1
云币
6

我在阿里的一台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新手,实在是找不到解决办法了,在这里恳请各位技术牛人帮我解解疑惑,谢谢!

级别: 论坛版主
发帖
13495
云币
30886

只看该作者 沙发  发表于: 2017-08-11
楼主您好, $U}GX'1LZ  
wnbKUlb  
欢迎来到阿里云论坛。 R}\n @X*  
xtRHb''FX  
我没有使用过 ElasticSearch, el^WBC3  
N(L?F):fT  
但根据您上述的情况来看, X##hSGQM  
# ,27,#  
publish_address {172.18.35.30:9300} 似乎您的应用服务是发布在内网的网络地址端口上了, 5KwT(R o  
M`.v/UQn  
您先确认一下ECS实例之间是否可通过发布的IP互访的吗? w:o,mzuXK  
@ykM98K  
或许您可以使用其它的虚拟IP来尝试,如n2n。
Debian 是一个自由的操作系统 (OS),提供您安装在计算机上使用。操作系统就是能让您的计算机工作的一系列基本程序和实用工具。
级别: 新人
发帖
1
云币
3
只看该作者 板凳  发表于: 2017-11-06
Re阿里云ElasticSearch集群无法发现非局域网节点
  1. network.publish_host: 192.168.0.88
  2. network.publish_host : 配置成外网ip[font=&quot] [font=&quot]即可
级别: 新人
发帖
1
云币
3
只看该作者 地板  发表于: 2017-11-27
Re阿里云ElasticSearch集群无法发现非局域网节点
大神,我遇到和你一样的问题,加我qq吧1147841113,一起讨论学习
级别: 新人
发帖
1
云币
3
只看该作者 4楼 发表于: 07-06
回 2楼马超小朋友的帖子
正解!
发表主题 回复主题
« 返回列表上一主题下一主题

限100 字节
批量上传需要先选择文件,再选择上传
 
验证问题: 阿里云官网域名是什么? 正确答案:www.aliyun.com
上一个 下一个