我创建了一个由1个JobManager和2个任务管理器组成的HA Flink v1.2群集,每个群集都在其自己的VM(不使用YARN或hdfs)中。 在JobManager节点上启动作业后,我终止了一个TaskManager实例。立即在Web仪表板中,我可以看到该作业被取消,然后失败。如果我检查日志:当任务管理器失败时,Flink预期HA行为
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自动重定向到其余/运行任务管理器的所有要求? 同样,如果我启动JobManager和1个TaskManager实例并运行作业,当我启动第2个TaskManager实例时它是否也有助于解决正在运行的作业?
谢谢!
嗨Dawid,谢谢你的答案,它为我清理了一些事情。我做了一个新的测试,并行度设置为1,每个TaskManager设置为1个插槽。你是对的,工作在剩余的TaskManager上被重试,但是我得到了一个错误:java.io.FileNotFoundException:/ home/ubuntu/Prototype/flink/flink-checkpoints/6fc6168a1e5a6a27f58f6d57deeacb65/chk-37/31c325f7-2b57-4e6b -bc20-3f6e9390a724(没有这样的文件或目录)。似乎检查点在第二个TaskManager上不可用。这会导致作业失败。你知道在TaskManager之间是否同步检查点? – razvan
检查点的存储位置取决于使用的StateBackend。有关更多信息,请参阅:https://ci.apache.org/projects/flink/flink-docs-release-1.2/ops/state_backends.html#state-backends –
当然,很明显,我使用文件系统作为后端状态。但是我在每个TaskManager上设置了本地路径(它们在不同的虚拟机中),并期望框架在JobManager中保持状态同步。显然不是,如果TaskManager出现故障并且本地保存了检查点,则作业将失败。你知道是否所有的TaskManagers后端状态localtion应该指向相同的路径吗?它生成名称为UUID的文件夹,希望确保不会有冲突。 – razvan