一、下载&启动
官网上下载安装包,执行下列命令即启动完成。
./bin/start-cluster.sh
效果图
Flink部署模式
- Standalone模式
- Yarn模式
- k8s部署
二、配置文件
flink-conf.yaml
# The number of task slots that each TaskManager offers. Each slot runs one parallel pipeline.
taskmanager.numberOfTaskSlots: 4
# The parallelism used for programs that did not specify and other parallelism.
parallelism.default: 1
三、提交任务
以UI的方式提交
以命令的方式提交
提交job
./flink run -c flink.StreamWordCount -p 2 myspark-1.0-SNAPSHOT.jar
查看当前所有job
> flink list
Waiting for response...
------------------ Running/Restarting Jobs -------------------
21.02.2020 03:35:27 : 97e8af8af740098de8e80a8aedd16839 : stream word count (RUNNING)
--------------------------------------------------------------
No scheduled jobs.
取消job
./flink cancel 97e8af8af740098de8e80a8aedd16839
异常
同样的代码,同样的操作,该异常只有在windows上部署的时候,才会出现问题,在MacBook上则是正常的。
java.util.concurrent.CompletionException:
org.apache.flink.runtime.jobmanager.scheduler.NoResourceAvailableException:
No pooled slot available and request to ResourceManager for new slot failed