当前位置:网站首页>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包名称
边栏推荐
猜你喜欢
随机推荐
(JLK105D)中山爆款LED恒流电源芯片方案
Matplotlib plotting notes
UDP组(多)播
七夕!专属于程序员的浪漫表白
DNSlog外带数据注入
[Tool Configuration] Summary of Common Uses of VSCode
Linux中安装Redis教程
【动态类型检测 Objective-C】
在小程序中关于js数字精度丢失的解决办法
AI + video technology helps to ensure campus security, how to build a campus intelligent security platform?
武田公司2022财年第一季度业绩强劲;正稳步实现全年的管理层指引目标
微信小程序仿input组件、虚拟键盘
2022熔化焊接与热切割操作证考试题及模拟考试
RNote108---显示R程序的运行进度
Shared memory + inotify mechanism to achieve multi-process low-latency data sharing
MySQL: basic part
Freeswitch操作基本配置
八大排序之快速排序
MySql面试题总结
typescript65-映射类型(keyof)









