准备测试文件
linux创建测试文件
登录 hadoop1 创建文件:
vim /program/data.txt
内容如下:
李雷
韩梅梅
lucy
lili
张三
李四
王五
李雷
韩梅梅
lucy
李雷
韩梅梅
李雷
执行:esc -> wq 退出
hdfs创建目录
hadoop fs -mkdir /test
hdfs上传
hadoop fs -put /program/data.txt /test/
将 linux 系统的 data.txt 文件,上传到 HDFS /test/ 路径
在web中查看
点击文件名称,显示如下图:
测试 wordcount
测试 wordcount,读取 HDFS 文件,将结果写入 HDFS 文件
/program/flink-1.12.5/bin/flink run /program/flink-1.12.5/examples/batch/WordCount.jar --input hdfs://hadoop1:8020/test/data.txt --output hdfs://hadoop1:8020/result3
执行结果:
Job has been submitted with JobID 3755c364053da2ce5836774d993913ee
Program execution finished
Job with JobID 3755c364053da2ce5836774d993913ee has finished.
Job Runtime: 3994 ms

