项目场景:

Flink算子执行报错:
Caused by: java.net.BindException: Could not start rest endpoint on any port in port range 10000
    at org.apache.flink.runtime.rest.RestServerEndpoint.start(RestServerEndpoint.java:234)
    at org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:172)
    ... 11 more
 


问题描述:

具体的报错日志:

org.apache.flink.util.FlinkException: Could not create the DispatcherResourceManagerComponent.
    at org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:275)
    at org.apache.flink.runtime.minicluster.MiniCluster.createDispatcherResourceManagerComponents(MiniCluster.java:463)
    at org.apache.flink.runtime.minicluster.MiniCluster.setupDispatcherResourceManagerComponents(MiniCluster.java:422)
    at org.apache.flink.runtime.minicluster.MiniCluster.start(MiniCluster.java:366)
    at org.apache.flink.client.program.PerJobMiniClusterFactory.submitJob(PerJobMiniClusterFactory.java:75)
    at org.apache.flink.client.deployment.executors.LocalExecutor.execute(LocalExecutor.java:85)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:1957)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1848)
    at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:69)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1834)
    at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1817)
    at com.atguigu.chapter05.transform.Flink01_MapFunction.main(Flink01_MapFunction.java:34)
Caused by: java.net.BindException: Could not start rest endpoint on any port in port range 10000
    at org.apache.flink.runtime.rest.RestServerEndpoint.start(RestServerEndpoint.java:234)
    at org.apache.flink.runtime.entrypoint.component.DefaultDispatcherResourceManagerComponentFactory.create(DefaultDispatcherResourceManagerComponentFactory.java:172)
    ... 11 more

原因分析:

这个提示十分明显,就是port端口的问题导致的。

conf.setInteger("rest.port", 10000);

代码中我设置的是10000,发现此端口被占用了。


解决方案:

修改一下端口即可。

conf.setInteger("rest.port", 9999);

问题解决。

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐