Apache Flink初接觸


Apache Flink聞名已久,一直沒有親自嘗試一把,這兩天看了文檔,發現在real-time streaming方面,Flink提供了更多高階的實用函數。

用Apache Flink實現WordCount

  • 下載Apache Flink 0.10.1
  • 啟動local模式
bin/start-local.sh
  • 運行scala-shell
bin/start-scala-shell.sh remote localhost 6123

Flink中JobManager的默認監聽端口是6123

  • wordcount
val text = env.fromElements("Whether The slings and arrows of outrageous fortune")
val counts = text.flatMap{ _.toLowerCase.split("\\W+")}.map{ (_,1)}.groupBy(0).sum(1)
counts.print


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM