import org.apache.flink.streaming.api.scala.StreamExecutionEnvironmentobject Fli { def main(args: Array[String]): Unit = { val env = StreamExecutionEnvironment.getExecutionEnvironment //本地文件 val stream = env.readTextFile("C:\Users\Administrator\Desktop\REITS-2022\a.txt") stream.print() //第二种获取数据源 利用nc-l -p 创造数据 val stream2 = env.socketTextStream("127.0.0.1",11111) stream2.print() env.execute("hello") }}
flink读取数据的两种方式
时间:2023-05-03
相关推荐