简体   繁体   English

Apache Flink在群集上引发UnknownHostException

[英]Apache Flink throws UnknownHostException on cluster

I have a flink project that is connecting to nifi to pull data. 我有一个flink项目正在连接到nifi以提取数据。 The setup to pull get the datastream works just fine when running locally. 在本地运行时,拉取获取数据流的设置工作正常。

.url("http://1.2.3.4:8080/nifi")
            .portName("MyPortName")
            .requestBatchCount(5)
            .buildConfig();

But when I add the .jar to the remote cluster and run the job it throws this: 但是,当我将.jar添加到远程集群并运行作业时,它将引发以下情况:

java.net.UnknownHostException
at sun.nio.ch.Net.translateException(Net.java:177)
at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:127)
at org.apache.nifi.remote.client.socket.EndpointConnectionPool.establishSiteToSiteConnection(EndpointConnectionPool.java:712)
at org.apache.nifi.remote.client.socket.EndpointConnectionPool.establishSiteToSiteConnection(EndpointConnectionPool.java:685)
at org.apache.nifi.remote.client.socket.EndpointConnectionPool.getEndpointConnection(EndpointConnectionPool.java:301)
at org.apache.nifi.remote.client.socket.SocketClient.createTransaction(SocketClient.java:129)
at org.apache.flink.streaming.connectors.nifi.NiFiSource.run(NiFiSource.java:90)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:78)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:55)
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask.run(SourceStreamTask.java:56)
at org.apache.flink.streaming.runtime.tasks.StoppableSourceStreamTask.run(StoppableSourceStreamTask.java:39)
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:272)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:655)
at java.lang.Thread.run(Thread.java:745)

The only reason I can find for an UnknownHostException is that it is because the IP of the host name can't be resolved, but I am giving the IP already. 我能找到UnknownHostException的唯一原因是因为无法解析主机名的IP,但是我已经提供了IP。 There was an issue earlier with it being unable to connect to nifi because I have to set what IP is allowed to access the nifi instance. 之前有一个问题,它无法连接到nifi,因为我必须设置允许访问nifi实例的IP。 So I added the AWS server as allowed and it fixed that, but obviously I have this now. 因此,我在允许的情况下添加了AWS服务器,并对其进行了修复,但显然现在有了。

Any help is greatly appreciated! 任何帮助是极大的赞赏!

I figured the problem. 我发现了问题。 I had my nifi cluster and my flink cluster in different regions. 我的nifi群集和flink群集位于不同的区域。 Moved the flink cluster to the same region and used either the public or private url for the cluster and it works fine. 将flink集群移到了相同的区域,并对该集群使用了公共URL或私有URL,它都能正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM