我已经部署了具有并行配置的Flink集群,如下所示:
jobmanager.heap.mb: 2048
taskmanager.heap.mb: 2048
taskmanager.numberOfTaskSlots: 5
parallelism.default: 2
但是如果我尝试使用-p
标志运行任何示例或jar,我会收到以下错误:
org.apache.flink.runtime.jobmanager.scheduler.NoResourceAvailableException:
Not enough free slots available to run the job. You can decrease the operator parallelism or increase the number of slots per TaskManager in the configuration.
Task to schedule: < Attempt #1 (Source: Custom Source -> Sink: Unnamed (1/1)) @ (unassigned) - [SCHEDULED] > with groupID < 22f48c24254702e4d1674069e455c81a > in sharing group < SlotSharingGroup [22f48c24254702e4d1674069e455c81a] >. Resources available to scheduler:
Number of instances=0, total number of slots=0, available slots=0
at org.apache.flink.runtime.jobmanager.scheduler.Scheduler.scheduleTask(Scheduler.java:255)
at org.apache.flink.runtime.jobmanager.scheduler.Scheduler.scheduleImmediately(Scheduler.java:131)
at org.apache.flink.runtime.executiongraph.Execution.scheduleForExecution(Execution.java:303)
at org.apache.flink.runtime.executiongraph.ExecutionVertex.scheduleForExecution(ExecutionVertex.java:453)
at org.apache.flink.runtime.executiongraph.ExecutionJobVertex.scheduleAll(ExecutionJobVertex.java:326)
at org.apache.flink.runtime.executiongraph.ExecutionGraph.scheduleForExecution(ExecutionGraph.java:742)
at org.apache.flink.runtime.executiongraph.ExecutionGraph.restart(ExecutionGraph.java:889)
at org.apache.flink.runtime.executiongraph.restart.FixedDelayRestartStrategy$1.call(FixedDelayRestartStrategy.java:80)
at akka.dispatch.Futures$$anonfun$future$1.apply(Future.scala:94)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
这不应该像仪表板显示的那样令人惊讶:
我尝试多次重启群集,但似乎没有使用配置。
答案 0 :(得分:2)
我遇到了同样的问题,我还记得什么时候Spark遇到问题,这是因为我新安装了JDK11进行测试,将我的环境变量JAVA_HOME
更改为
/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home.
因此我将JAVA_HOME设置回JDK8使用:
导出JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
,一切运行顺利。该路径适用于我的Mac,您可以找到自己的JAVA_HOME
。希望会有所帮助。
答案 1 :(得分:0)
异常仅表示没有任务管理器,因此没有可用于运行作业的插槽。任务管理器完成的原因可能很多,例如未命中配置的运行时异常。只是检查日志的确切原因。 您需要重新启动集群,并且当仪表板中的任务管理器可用时,再次运行该作业。 您可以在配置中定义适当的重启策略,如FIXED延迟重启,以便在真正失败的情况下作业将重试。
答案 2 :(得分:0)
我有一个与您相似的问题。我将flink目录的权限设置为775,然后解决了该问题。
答案 3 :(得分:0)
最后,对于我来说,我已解决此FLINK问题。首先,我将说明根本原因,然后说明解决方法。
请检查Flink日志并拖尾任务执行程序日志
tail -500f flink-root-taskexecutor-3-osboxes.out在以下日志中找到。
Invalid maximum direct memory size: -XX:MaxDirectMemorySize=8388607T
The specified size exceeds the maximum representable size.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
为什么会这样,因为Java版本不正确。操作系统基于64位,但我安装了32位jdk。
解决方案: 1.安装正确的JDK-1.8 64位[任务执行器中的安装错误消失后]
我的问题得到解决,并且Flink群集在本地和云上均运行正常。