通过3步,在本地搭建Flink环境
前提:本地安装有JDK8+
java -version
1、下载Flink文件,并解压(linux/mac系统)
$ tar -xzf flink-1.11.0-bin-scala_2.12.tgz
$ cd flink-1.11.0-bin-scala_2.12
2、启动集群(启动成功后,可以访问http://localhost:8081查看任务)
$ ./bin/start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host.
Starting taskexecutor daemon on host.
3、验证环境,flink提供了丰富的例子,我们通过提交一个任务到flink集群
$ ./bin/flink run examples/streaming/WordCount.jar
$ tail log/flink-*-taskexecutor-*.out
(to,1)
(be,1)
(or,1)
(not,1)
(to,2)
(be,2)
4、关闭集群
$ ./bin/stop-cluster.sh