Flink从入门到实战一[快速上手]-2-Flink本地模式安装

运行Flink的前提,需提前安装好 Java 8 或者 Java 11。

1:下载并解压
下载地址:https://flink.apache.org/zh/downloads.html
解压命令:tar -xzf flink-1.14.3-bin-scala_2.11.tgz

2:启动集群
$ cd flink-1.14.3-bin-scala_2.11
$ ./bin/start-cluster.sh

输出:
Starting cluster.
Starting standalonesession daemon on host DESKTOP-UCGATI0.
Starting taskexecutor daemon on host DESKTOP-UCGATI0.

3:提交作业(Job)
$ ./bin/flink run examples/streaming/WordCount.jar

查看日志:
$ tail log/flink--taskexecutor-.out
==> log/flink-root-taskexecutor-0-DESKTOP-UCGATI0.out <==
(nymph,1)
(in,3)
(thy,1)
(orisons,1)
(be,4)
(all,2)
(my,1)
(sins,1)
(remember,1)
(d,4)

4:停止集群
$ ./bin/stop-cluster.sh