Installation
Local Setup Flink 1.7 on Linux
See https://ci.apache.org/projects/flink/flink-docs-release-1.7/tutorials/local_setup.html
Pre-install
jdk 8
Download
https://flink.apache.org/downloads.html
1 | wget http://mirror.bit.edu.cn/apache/flink/flink-1.7.2/flink-1.7.2-bin-scala_2.11.tgz |
浏览器访问:http://localhost:8081
组件
- TaskManagerRunner:28634/32732和本地13076
- StandaloneSessionClusterEntrypoint:6123/8081/4767/22889
Local Setup on Windows
See https://ci.apache.org/projects/flink/flink-docs-release-1.7/tutorials/flink_on_windows.html
Download 同上 & 解压
1 | cd D:\flink-1.7.2\bin |
浏览器访问:http://localhost:8081
Configuration
flink-1.7.2/conf/flink-conf.yaml
Example
Streaming Example:SocketWindowWordCount
打好的包在安装目录下examples下都有
会话1,本地启动server监听9009
1 | nc -l 9009 |
会话2,运行example
1 | cd $FLINK_HOME |
会话3,查看结果
1 | tail -f flink-*-taskexecutor-*.out |
在会话1中输入一些什么,按回车提交
这个例子功能是:每5s统计输入(会话1)的单词出现次数
Batch Examples: WordCount
https://ci.apache.org/projects/flink/flink-docs-release-1.8/dev/batch/examples.html#word-count
代码 https://github.com/apache/flink/blob/master//flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/wordcount/WordCount.java
1 | ./bin/flink run examples/streaming/WordCount.jar --input a.log --output result.log |