我在自己的VM(不使用YARN或hdfs)中创建了一个由1个JobManager和2个TaskManagers组成的HA Flink v1.2集群。 在JobManager节点上启动作业后,我终止了一个TaskManager实例。在Web仪表板中,我可以立即看到作业被取消然后失败。如果我查看日志:
03/06/2017 16:23:50 Flat Map(1/2) switched to DEPLOYING
03/06/2017 16:23:50 Flat Map(2/2) switched to SCHEDULED
03/06/2017 16:23:50 Flat Map(2/2) switched to DEPLOYING
03/06/2017 16:23:50 Flat Map(1/2) switched to RUNNING
03/06/2017 16:23:50 Source: Custom Source -> Flat Map(1/2) switched to RUNNING
03/06/2017 16:23:50 Flat Map(2/2) switched to RUNNING
03/06/2017 16:23:50 Source: Custom Source -> Flat Map(2/2) switched to RUNNING
03/06/2017 16:25:38 Flat Map(1/2) switched to FAILED
org.apache.flink.runtime.io.network.netty.exception.RemoteTransportException: Connection unexpectedly closed by remote task manager 'ip-10-106-0-238/10.106.0.238:40578'. This might indicate that the remote task manager was lost.
at org.apache.flink.runtime.io.network.netty.PartitionRequestClientHandler.channelInactive(PartitionRequestClientHandler.java:118)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:223)
at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:75)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:223)
at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:294)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:223)
at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:829)
at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:610)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at java.lang.Thread.run(Thread.java:745)
03/06/2017 16:25:38 Job execution switched to status FAILING.
org.apache.flink.runtime.io.network.netty.exception.RemoteTransportException: Connection unexpectedly closed by remote task manager 'ip-10-106-0-238/10.106.0.238:40578'. This might indicate that the remote task manager was lost.
at org.apache.flink.runtime.io.network.netty.PartitionRequestClientHandler.channelInactive(PartitionRequestClientHandler.java:118)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:223)
at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:75)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:223)
at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:294)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:223)
at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:829)
at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:610)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at java.lang.Thread.run(Thread.java:745)
03/06/2017 16:25:38 Source: Custom Source -> Flat Map(1/2) switched to CANCELING
03/06/2017 16:25:38 Source: Custom Source -> Flat Map(2/2) switched to CANCELING
03/06/2017 16:25:38 Flat Map(2/2) switched to CANCELING
03/06/2017 16:25:38 Source: Custom Source -> Flat Map(1/2) switched to CANCELED
03/06/2017 16:26:18 Source: Custom Source -> Flat Map(2/2) switched to CANCELED
03/06/2017 16:26:18 Flat Map(2/2) switched to CANCELED
在我的工作实施中
env.setRestartStrategy(RestartStrategies.fixedDelayRestart(3, // number
// of
// restart
// attempts
Time.of(10, TimeUnit.SECONDS) // delay
));
我的问题是,JobManager是否应该自动将所有请求重定向到剩余/正在运行的TaskManager? 同样,如果我启动JobManager和1个TaskManager实例,并运行一个作业,当我启动第二个TaskManager实例时,它是否也有助于解决正在运行的作业?
谢谢!
答案 0 :(得分:1)
首先,RestartStrategy
与HA模式无关。高可用性涉及JobManager
的可用性。无论如何,HA需要至少工作两个JobManagers实例(你说你只开始一个)。
对于RestartStrategy
,当您在失败后指定fixedDelayRestart
策略时(例如在例如kill TaskManager中),将尝试再次运行作业(在您的情况下,10秒后) )。如果在您的安装中不是这种情况,您可能缺少可运行作业的可用资源(我假设您每TaskManager
有1个任务位置,因此当只剩下一个任务时,您无法运行作业并行度为2或更多)。
对于最后一个问题,添加TaskManager
对正在运行的作业没有贡献。以某种方式连接的行为称为动态缩放。您可以通过获取保存点然后使用更多资源重新运行它来执行此操作。看看here。自动重新缩放正在进行中。