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包名称