https://mp.weixin.qq.com/s/2kbMDuEH70D4s5io6UOBCw
https://mp.weixin.qq.com/s?__biz=Mzg3MTIzOTgxOA==&mid=2247483798&idx=1&sn=febfc8fe3bc0aabd52e96da2bac872ab&scene=21#wechat_redirect

在Linux上单节点安装方式与cygwin一样,下载Apache Flink 1.9.0 for Scala 2.12,然后解压后只需要启动start-cluster.sh。

集群安装

集群安装分为以下几步:
1、在每台机器上复制解压出来的flink目录。
2、选择一个作为master节点,然后修改所有机器conf/flink-conf.yaml
jobmanager.rpc.address = master主机名

3、修改conf/slaves,将所有work节点写入
work01
work02

4、在master上启动集群
./bin/start-cluster.sh

运行flink示例程序

批处理示例:

提交flink的批处理examples程序:

  1. bin/flink run examples/batch/WordCount.jar

这是flink提供的examples下的批处理例子程序,统计单词个数。

  1. $ bin/flink run examples/batch/WordCount.jar
  2. Starting execution of program
  3. Executing WordCount example with default input data set.
  4. Use --input to specify file input.
  5. Printing result to stdout. Use --output to specify output path.
  6. (a,5)
  7. (action,1)
  8. (after,1)
  9. (against,1)
  10. (all,2)
  11. (and,12)
  12. (arms,1)
  13. (arrows,1)
  14. (awry,1)
  15. (ay,1)

得到结果,这里统计的是默认的数据集,可以通过—input —output指定输入输出。
我们可以在页面中查看运行的情况:
Flink 入门安装 - 图1

—hostname 192.168.161.7 —port 9999
—hostname 192.168.161.7 —port 9990