美文网首页
Flink Akka端口绑定异常Could not start

Flink Akka端口绑定异常Could not start

作者: 清蒸三文鱼_ | 来源:发表于2024-04-16 18:31 被阅读0次

    描述

    启动Flink任务的时候, 报错Could not deploy Yarn job cluster, 查看yarn logs -applicationId xxx发现BindException, 查看jobmanager所在机器占用端口过多, 导致启动任务失败, kill掉异常进程后启动正常.

    异常

    2024-04-15 14:31:03,129 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] - Initializing cluster services.
    2024-04-15 14:31:03,150 INFO  org.apache.flink.runtime.rpc.akka.AkkaRpcServiceUtils        [] - Trying to start actor system, external address hadoop-node1:0, bind address 0.0.0.0:0.
    2024-04-15 14:31:03,700 INFO  akka.event.slf4j.Slf4jLogger                                 [] - Slf4jLogger started
    2024-04-15 14:31:03,727 INFO  akka.remote.Remoting                                         [] - Starting remoting
    2024-04-15 14:31:03,904 ERROR akka.remote.transport.netty.NettyTransport                   [] - failed to bind to /0.0.0.0:0, shutting down Netty transport
    2024-04-15 14:31:03,913 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] - Shutting YarnJobClusterEntrypoint down with application status FAILED. Diagnostics java.net.BindException: Could not start actor system on any port in port range 0
            at org.apache.flink.runtime.clusterframework.BootstrapTools.startRemoteActorSystem(BootstrapTools.java:173)
            at org.apache.flink.runtime.rpc.akka.AkkaRpcServiceUtils$AkkaRpcServiceBuilder.createAndStart(AkkaRpcServiceUtils.java:370)
            at org.apache.flink.runtime.rpc.akka.AkkaRpcServiceUtils$AkkaRpcServiceBuilder.createAndStart(AkkaRpcServiceUtils.java:344)
            at org.apache.flink.runtime.rpc.akka.AkkaRpcServiceUtils.createRemoteRpcService(AkkaRpcServiceUtils.java:92)
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.initializeServices(ClusterEntrypoint.java:294)
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runCluster(ClusterEntrypoint.java:239)
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.lambda$startCluster$1(ClusterEntrypoint.java:189)
            at java.security.AccessController.doPrivileged(Native Method)
            at javax.security.auth.Subject.doAs(Subject.java:422)
            at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1875)
            at org.apache.flink.runtime.security.contexts.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:186)
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runClusterEntrypoint(ClusterEntrypoint.java:600)
            at org.apache.flink.yarn.entrypoint.YarnJobClusterEntrypoint.main(YarnJobClusterEntrypoint.java:99)
    .
    2024-04-15 14:31:03,920 INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator        [] - Shutting down remote daemon.
    2024-04-15 14:31:03,922 INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator        [] - Remote daemon shut down; proceeding with flushing remote transports.
    2024-04-15 14:31:03,925 ERROR akka.remote.Remoting                                         [] - Remoting system has been terminated abrubtly. Attempting to shut down transports
    2024-04-15 14:31:03,926 INFO  akka.remote.RemoteActorRefProvider$RemotingTerminator        [] - Remoting shut down.
    2024-04-15 14:31:03,928 ERROR org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] - Could not start cluster entrypoint YarnJobClusterEntrypoint.
    org.apache.flink.runtime.entrypoint.ClusterEntrypointException: Failed to initialize the cluster entrypoint YarnJobClusterEntrypoint.
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:212) ~[flink-dist_2.11-1.13.1.jar:1.13.1]
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runClusterEntrypoint(ClusterEntrypoint.java:600) [flink-dist_2.11-1.13.1.jar:1.13.1]
            at org.apache.flink.yarn.entrypoint.YarnJobClusterEntrypoint.main(YarnJobClusterEntrypoint.java:99) [flink-dist_2.11-1.13.1.jar:1.13.1]
    Caused by: java.net.BindException: Could not start actor system on any port in port range 0
            at org.apache.flink.runtime.clusterframework.BootstrapTools.startRemoteActorSystem(BootstrapTools.java:173) ~[flink-dist_2.11-1.13.1.jar:1.13.1]
            at org.apache.flink.runtime.rpc.akka.AkkaRpcServiceUtils$AkkaRpcServiceBuilder.createAndStart(AkkaRpcServiceUtils.java:370) ~[flink-dist_2.11-1.13.1.jar:1.13.1]
            at org.apache.flink.runtime.rpc.akka.AkkaRpcServiceUtils$AkkaRpcServiceBuilder.createAndStart(AkkaRpcServiceUtils.java:344) ~[flink-dist_2.11-1.13.1.jar:1.13.1]
            at org.apache.flink.runtime.rpc.akka.AkkaRpcServiceUtils.createRemoteRpcService(AkkaRpcServiceUtils.java:92) ~[flink-dist_2.11-1.13.1.jar:1.13.1]
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.initializeServices(ClusterEntrypoint.java:294) ~[flink-dist_2.11-1.13.1.jar:1.13.1]
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.runCluster(ClusterEntrypoint.java:239) ~[flink-dist_2.11-1.13.1.jar:1.13.1]
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.lambda$startCluster$1(ClusterEntrypoint.java:189) ~[flink-dist_2.11-1.13.1.jar:1.13.1]
            at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_101]
            at javax.security.auth.Subject.doAs(Subject.java:422) ~[?:1.8.0_101]
            at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1875) ~[flink-shaded-hadoop-2-uber-3.0.0-cdh6.3.0-10.0.jar:3.0.0-cdh6.3.0-10.0]
            at org.apache.flink.runtime.security.contexts.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41) ~[flink-dist_2.11-1.13.1.jar:1.13.1]
            at org.apache.flink.runtime.entrypoint.ClusterEntrypoint.startCluster(ClusterEntrypoint.java:186) ~[flink-dist_2.11-1.13.1.jar:1.13.1]
            ... 2 more
    2024-04-15 14:31:05,238 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] - --------------------------------------------------------------------------------
    2024-04-15 14:31:05,242 INFO  org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] -  Starting YarnJobClusterEntrypoint (Version: 1.13.1, Scala: 2.11, Rev:DeadD0d0, Date:1970-01-01T01:00:00+01:00)
    

    解决步骤

    1. 日志中Trying to start actor system后面会有异常的host, 去到这台机器查看端口情况, cat /proc/sys/net/ipv4/ip_local_port_range查看可用访问, 默认是32768-60999, 可用端口约为28000, netstat -anp | wc -l查看目前连接数, 如果远远超过这个数可能某个进程占用了大量的端口, 导致无法分配, kill掉这个异常的进程
    2. 如果步骤1端口范围正常, 可尝试修改flink-conf.yaml配置, 加上yarn.application-master.port : 32768-60999

    相关文章

      网友评论

          本文标题:Flink Akka端口绑定异常Could not start

          本文链接:https://www.haomeiwen.com/subject/mlajxjtx.html