没有可用插槽

wswtfjt7  于 2021-06-25  发布在  Flink
关注(0)|答案(4)|浏览(531)

我部署了flink群集,其并行配置如下:

jobmanager.heap.mb: 2048
taskmanager.heap.mb: 2048
taskmanager.numberOfTaskSlots: 5
parallelism.default: 2

但是如果我尝试运行任何示例或jar,即使 -p 标志i接收到以下错误:

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)

正如 Jmeter 板显示的那样,这一点并不令人意外:

我多次尝试重新启动集群,但似乎没有使用配置。

8i9zcol2

8i9zcol21#

异常仅仅意味着没有任务管理器,因此没有可用的插槽来运行作业。任务管理器执行任务的原因可能有很多,例如未完成配置的运行时异常。只要查一下日志就知道了。您需要重新启动集群,当任务管理器在 Jmeter 板中可用时,再次运行作业。您可以在config中定义适当的重启策略,比如fixed delay restart,以便在真正失败的情况下作业将重试。

j2datikz

j2datikz2#

最后我找到了解决Flink问题的方法。首先我将解释根本原因,然后解释解决方案。

根本原因:无法创建java虚拟机。

请检查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-conf.yaml文件update taskmanager.numberoftaskslots:10 parallelism.default:1
我的问题得到了解决,flink集群在本地和云上都运行得很好。

yftpprvb

yftpprvb3#

我有一个和你一样的问题。我将flink目录的权限设置为775,然后解决了它。

qgelzfjb

qgelzfjb4#

我也遇到了同样的问题,我记得什么时候会遇到问题,这是因为我新安装了jdk11用于测试,这改变了我的env var JAVA_HOME/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home. 所以我将javau home设置回jdk8 use:export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home 一切都很顺利。那条路是给我的mac的,你可以自己找 JAVA_HOME . 希望这会有帮助。

相关问题