package com.lin.spark

import org.apache.spark.sql.SparkSession

object StructuredStreaming {
def main(args: Array[String]): Unit = {
val spark = SparkSession
.builder()
.appName("StructuredStreaming")
.master("local[2]")
.getOrCreate() import spark.implicits._ val lines = spark.readStream
.format("socket")
.option("host","hadoop000")
.option("port",9999)
.load() val words = lines.as[String].flatMap(_.split(" ")) val wordCounts = words.groupBy("value").count() val query = wordCounts.writeStream
.outputMode("complete")
.format("console")
.start() query.awaitTermination()
}
}
> nc -lk 9999

Structured Streaming本地local运行小例子的更多相关文章

  1. 一个spark streaming的黑名单过滤小例子

    > nc -lk 9999 20190912,sz 20190913,lin package com.lin.spark.streaming import org.apache.spark.Sp ...

  2. 无法定位 Local Database Runtime 安装。请验证 SQL Server Express 是否正确安装以及本地数据库运行时功能是否已启用。

    错误描述: 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误.未找到或无法访问服务器.请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接. (provide ...

  3. 从源码编译安装PCL并运行第一个小例子

    如何通过源码编译方式安装PCL 对于很多想学习PCL的同学而言,往往会被如何安装困扰很长时间.我就是这其中的一员,为了不让大家在安装问题上浪费太多时间,我决心写下这篇小小的随笔,希望对大家有所帮助. ...

  4. Structured Streaming教程(1) —— 基本概念与使用

    近年来,大数据的计算引擎越来越受到关注,spark作为最受欢迎的大数据计算框架,也在不断的学习和完善中.在Spark2.x中,新开放了一个基于DataFrame的无下限的流式处理组件--Structu ...

  5. Structured Streaming编程向导

    简介 Structured Streaming is a scalable and fault-tolerant stream processing engine built on the Spark ...

  6. Spark之Structured Streaming

    目录 Part V. Streaming Stream Processing Fundamentals Structured Streaming Basics Event-Time and State ...

  7. Structured Streaming编程 Programming Guide

    Structured Streaming编程 Programming Guide Overview Quick Example Programming Model Basic Concepts Han ...

  8. 大数据技术之_19_Spark学习_04_Spark Streaming 应用解析 + Spark Streaming 概述、运行、解析 + DStream 的输入、转换、输出 + 优化

    第1章 Spark Streaming 概述1.1 什么是 Spark Streaming1.2 为什么要学习 Spark Streaming1.3 Spark 与 Storm 的对比第2章 运行 S ...

  9. 学习Spark2.0中的Structured Streaming(一)

    转载自:http://lxw1234.com/archives/2016/10/772.htm Spark2.0新增了Structured Streaming,它是基于SparkSQL构建的可扩展和容 ...

随机推荐

  1. MS DOS 常用命令整理

    最近在开发用到一些dos下的一些指令,还有bat文件,特别是bat的便捷性让我在生活和开发过程中好好使用. dos指令: java com.pdcss.util.JacobService > D ...

  2. 分析abex'crackme#1

    测试文件下载:https://www.wocloud.com.cn/webclient/share/sindex.action?id=i9K_Br6TgE7Kf_YTF04yHmKcRy5TUdZ8U ...

  3. 一网打尽 @ExceptionHandler、HandlerExceptionResolver、@controlleradvice 三兄弟!

    把 @ExceptionHandler.HandlerExceptionResolver.@controlleradvice 三兄弟放在一起来写更有比较性.这三个东西都是用来处理异常的,但是它们使用的 ...

  4. weblogic下载

    1.网址 https://edelivery.oracle.com/osdc/faces/SoftwareDelivery 2.信息

  5. pip安装依赖包

    pip install -r requirements.txt setup.py 模块使用 https://blog.csdn.net/neil_pan/article/details/7900129 ...

  6. Djano中static和media文件路径的设置

    对于常用的css.js.image和常用的工具类在django项目中要设置一个全局的路径,对所有的app都可以访问到这个路径下的文件 1在django项目的setting文件中设置对应的static和 ...

  7. 利用 Redis 锁解决高并发问题

    这里我们主要利用 Redis 的 setnx 的命令来处理高并发. setnx 有两个参数.第一个参数表示键.第二个参数表示值.如果当前键不存在,那么会插入当前键,将第二个参数做为值.返回 1.如果当 ...

  8. H2database创建表

    语法和sql server大同小异 create table users(id int primary key not null int identity, name varchar(20))

  9. bzoj3717 [PA2014]Pakowanie 贪心+状压DP

    题目传送门 https://lydsy.com/JudgeOnline/problem.php?id=3717 题解 这道题大概也就只能算常规的状压 DP 吧,但是这个状态和转移的设计还是不是很好想. ...

  10. 10.VScode Debug——2019年12月12日

    title: vscode debug date: "2019-09-17 16:17:16" tags: 技巧 categories: 技术驿站 1.为什么需要调试 写了很多行代 ...