日常Exception第二十九回:Flink启动异常之java.net.UnknownHostException: xxxx: Name or service not known
Posted 善良勤劳勇敢而又聪明的老杨
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了日常Exception第二十九回:Flink启动异常之java.net.UnknownHostException: xxxx: Name or service not known相关的知识,希望对你有一定的参考价值。
热门系列:
1、问题
今天启动测试环境的flink内的服务,启动过程中发生了如下报错:
org.apache.flink.util.FlinkException: Failed to retrieve job list.
Caused by: java.net.UnknownHostException: fat: Name or service not known
The program finished with the following exception:
org.apache.flink.util.FlinkException: Failed to retrieve job list.
at org.apache.flink.client.cli.CliFrontend.listJobs(CliFrontend.java:449)
at org.apache.flink.client.cli.CliFrontend.lambda$list$0(CliFrontend.java:430)
at org.apache.flink.client.cli.CliFrontend.runClusterAction(CliFrontend.java:1002)
at org.apache.flink.client.cli.CliFrontend.list(CliFrontend.java:427)
at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1060)
at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1132)
at org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:28)
at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1132)
Caused by: org.apache.flink.runtime.concurrent.FutureUtils$RetryException: Could not complete the operation. Number of retries has been exhausted.
at org.apache.flink.runtime.concurrent.FutureUtils.lambda$retryOperationWithDelay$9(FutureUtils.java:386)
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760)
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
at org.apache.flink.runtime.rest.RestClient.lambda$submitRequest$1(RestClient.java:430)
at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:551)
at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:608)
at org.apache.flink.shaded.netty4.io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:117)
at org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:284)
at org.apache.flink.shaded.netty4.io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342)
at org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
at org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533)
at org.apache.flink.shaded.netty4.io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.connect(CombinedChannelDuplexHandler.java:495)
at org.apache.flink.shaded.netty4.io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:51)
at org.apache.flink.shaded.netty4.io.netty.channel.CombinedChannelDuplexHandler.connect(CombinedChannelDuplexHandler.java:296)
at org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
at org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533)
at org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:517)
at org.apache.flink.shaded.netty4.io.netty.channel.DefaultChannelPipeline.connect(DefaultChannelPipeline.java:978)
at org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannel.connect(AbstractChannel.java:253)
at org.apache.flink.shaded.netty4.io.netty.bootstrap.Bootstrap$3.run(Bootstrap.java:250)
at org.apache.flink.shaded.netty4.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at org.apache.flink.shaded.netty4.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at org.apache.flink.shaded.netty4.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at org.apache.flink.shaded.netty4.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at org.apache.flink.shaded.netty4.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.CompletionException: java.net.UnknownHostException: fat: fat: Name or service not known
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
at java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:943)
at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:926)
... 28 more
Caused by: java.net.UnknownHostException: fat: fat: Name or service not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:647)
at org.apache.flink.shaded.netty4.io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:91)
at org.apache.flink.shaded.netty4.io.netty.util.internal.SocketUtils$3.run(SocketUtils.java:88)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.flink.shaded.netty4.io.netty.util.internal.SocketUtils.connect(SocketUtils.java:88)
at org.apache.flink.shaded.netty4.io.netty.channel.socket.nio.NiosocketChannel.doConnect(NioSocketChannel.java:315)
at org.apache.flink.shaded.netty4.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:248)
... 18 more
Caused by: java.net.UnknownHostException: fat: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getLocalHost(InetAddress.java:1500)
... 25 more
2、解决办法
根据提示内容分析,是启动过程中,flink无法识别 fat 这个hostname。所以,直接按如下步骤操作即可:
- 第一步,使用命令:vim /etc/hosts,在编辑页面中,加上你的映射ip及host名称,如:192.168.*.* fat
- 第二步,使用命令:/etc/init.d/network restart,刷新hosts文件,使其生效
按照如上步骤,再次重启flink服务,就不回再报错啦!!!
以上是关于日常Exception第二十九回:Flink启动异常之java.net.UnknownHostException: xxxx: Name or service not known的主要内容,如果未能解决你的问题,请参考以下文章
日常Exception第三十回:Flink异常NoResourceAvailableException: Could not acquire the minimum required resour
日常Exception第三十回:Flink异常NoResourceAvailableException: Could not acquire the minimum required resour
日常Exception第三十回:Flink异常NoResourceAvailableException: Could not acquire the minimum required resour
日常Exception第二十五回:Flink启动job时报错,AbstractChannel$AnnotatedConnectException: Connection refused.....
日常Exception第二十五回:Flink启动job时报错,AbstractChannel$AnnotatedConnectException: Connection refused.....
日常Exception第二十五回:Flink启动job时报错,AbstractChannel$AnnotatedConnectException: Connection refused.....(代码