当前位置:网站首页>Flink学习10:使用idea编写WordCount,并打包运行
Flink学习10:使用idea编写WordCount,并打包运行
2022-08-05 06:35:00 【hzp666】
1.编写程序
5个步骤
import org.apache.flink.api.scala._
object flinkTest {
def main(args: Array[String]): Unit = {
//first: build env
val env = ExecutionEnvironment.getExecutionEnvironment
//second: create datasource
val text: DataSet[String] = env.fromElements(
"hello,dog",
"hell0,cat",
"hello,dog"
)
//third: transfer
val counts = text.flatMap(_.toLowerCase.split(","))
.map((_, 1))
.groupBy(0)
.sum(1)
//Fourth: print
counts.print()
}
}
}
}
输出结果:

2.编译打包
点击右侧的maven,然后双击package,即可
等介绍后可以在左侧target 中看到jar包

3.提交集群执行

--class 指定类的名称,空格 指定jar包名称
边栏推荐
- MySQL: basic part
- Pytorch distributed parallel processing
- 微信小程序仿input组件、虚拟键盘
- mysql使用in函数的一个小问题
- 技术分析模式(七)发挥差距
- 怎么样避免线上内存泄漏
- 数据库多表关联插入数据
- After working for 3 years, I recalled the comparison between the past and the present when I first started, and joked about my testing career
- Technical Analysis Mode (8) Double Top and Bottom
- Redis
猜你喜欢
随机推荐
HR:这样的简历我只看了5秒就扔了,软件测试简历模板想要的进。
真实字节跳动测试开发面试题,拿下年薪50万offer。
Mysql主从延迟的原因和解决方案
腾讯业务安全岗 IDP 谈话总结
开启防火墙iptable规则后,系统网络变慢
技术分析模式(十)头肩图案
八大排序之快速排序
铠侠携手Aerospike提升数据库应用性能
技术分析模式(七)发挥差距
边缘盒子+时序数据库,美的数字化平台 iBUILDING 背后的技术选型
h5页面回退到微信小程序并携带参数
不太会讲爱,其实已经偷偷幸福很久啦----我们的故事
(JLK105D)中山爆款LED恒流电源芯片方案
微信小程序仿input组件、虚拟键盘
MyCat安装
2022起重机司机(限桥式起重机)考试题库及模拟考试
typescript68-索引查询类型(查询多个)
【C语言】结构体变量数据通过 void* 传入到函数中
共享内存+inotify机制实现多进程低延迟数据共享
(4) Rotating object detection data roLabelImg to DOTA format







