1、安装
1. 下载、解压
https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.9.3/

解压缩...
2. 配置flink-1.9.3/conf/flink-conf.yaml
在这个文件里面需要指明已经另行安装的hadoop的conf目录和master节点的主机名。增加如下配置:
env.hadoop.conf.dir: '/home/yay/software/hadoop-3.2.1/conf'
jobmanager.rpc.address: yay-ThinkPad-T470-W10DG
3. 启动flink
yay@yay-ThinkPad-T470-W10DG:~/software/flink-1.9.3$ start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host yay-ThinkPad-T470-W10DG.
Starting taskexecutor daemon on host yay-ThinkPad-T470-W10DG.
yay@yay-ThinkPad-T470-W10DG:~/software/flink-1.9.3$
4. 提交作业
下载实例代码:https://streaming-with-flink.github.io/examples/download/examples-scala.jar
然后放到当前用户的主目录。
接着运行作业:
yay@yay-ThinkPad-T470-W10DG:~/software/flink-1.9.3$ cd ..
yay@yay-ThinkPad-T470-W10DG:~/software$ cd ..
yay@yay-ThinkPad-T470-W10DG:~$ flink run -c io.github.streamingwithflink.chapter1.AverageSensorReadings examples-scala.jar
Starting execution of program
查看作业情况:



https://www.yht7.com/news/20718
有这个界面功能区的介绍,我们可以了解一下
查看作业的输出:
yay@yay-ThinkPad-T470-W10DG:~/software/flink-1.9.3$ cd log
yay@yay-ThinkPad-T470-W10DG:~/software/flink-1.9.3/log$ dir
flink-yay-client-yay-ThinkPad-T470-W10DG.log
flink-yay-standalonesession-0-yay-ThinkPad-T470-W10DG.log
flink-yay-standalonesession-0-yay-ThinkPad-T470-W10DG.out
flink-yay-taskexecutor-0-yay-ThinkPad-T470-W10DG.log
flink-yay-taskexecutor-0-yay-ThinkPad-T470-W10DG.out
yay@yay-ThinkPad-T470-W10DG:~/software/flink-1.9.3/log$ tail -f flink-yay-taskexecutor-0-yay-ThinkPad-T470-W10DG.out
SensorReading(sensor_10,1590074445000,17.070776377540533)
SensorReading(sensor_8,1590074445000,62.35354623324231)
SensorReading(sensor_1,1590074445000,3.0576551271903507)
SensorReading(sensor_9,1590074445000,-24.31662376498374)
SensorReading(sensor_2,1590074445000,50.26566716734396)
SensorReading(sensor_7,1590074445000,-11.565551113941925)
SensorReading(sensor_3,1590074445000,-12.078212608770112)
SensorReading(sensor_6,1590074445000,28.959988674516715)
SensorReading(sensor_4,1590074445000,31.027221507173646)
SensorReading(sensor_5,1590074445000,0.9306489929118266)
5. 取消作业

6. 停止Flink
yay@yay-ThinkPad-T470-W10DG:~$ stop-cluster.sh
Stopping taskexecutor daemon (pid: 5136) on host yay-ThinkPad-T470-W10DG.
Stopping standalonesession daemon (pid: 4692) on host yay-ThinkPad-T470-W10DG.
yay@yay-ThinkPad-T470-W10DG:~$ jps
10383 Jps
yay@yay-ThinkPad-T470-W10DG:~$
网友评论