当前位置:网站首页>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包名称
边栏推荐
猜你喜欢

软件测试必问面试题(附答案和解析)

Nacos cluster construction

lingo入门——河北省第三届研究生建模竞赛B题

Tips for formatting code indentation

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

《PyTorch深度学习实践》第十课(卷积神经网络CNN)

Source code analysis of Nacos configuration service (full)

(JLK105D)中山爆款LED恒流电源芯片方案

MySQL: basic part

(2022杭电多校六)1010-Planar graph(最小生成树)
随机推荐
Promise (3) async/await
Technical Analysis Mode (7) Playing the Gap
360度反馈调查表中的问题示范
UDP组(多)播
PCI Pharma Services宣布斥资数百万美元扩建英国制造设施,以满足市场对支持肿瘤治疗的全球高效药制造服务日益增长的需求
(JLK105D)中山爆款LED恒流电源芯片方案
2022杭电多校六 1006-Maex (树形DP)
基于KECA-IGWO-KELM的间歇过程故障诊断方法
Tips for formatting code indentation
MySQL:JDBC编程
(2022杭电多校六)1012-Loop(单调栈+思维)
h5页面回退到微信小程序并携带参数
技术分析模式(十)头肩图案
protobuf根据有关联的.proto文件进行编译
原来使Maya Arnold也能渲染出高质量作品!超赞小技巧
Technical Analysis Patterns (11) How to Trade Head and Shoulders Patterns
Redis
《基于R语言的自动数据收集》--第3章 XML和JSON
Redis
【instancetype类型 Objective-C】