flink入门

 

测试socketWindowWordCount example

win10端安装下载netcat(https://eternallybored.org/misc/netcat/netcat-win32-1.12.zip),将可执行文件加入环境变量Path

执行命令 nc -l -p 9000   (监听9000端口,如果联通可以发送消息)【linux上直接 nc -l 9000即可】

# 启动集群
./bin/start-cluster.sh

nc -l 9000  # 启动netcat,向9000发送消息

# 运行flink example
./bin/flink run examples/streaming/SocketWindowWordCount.jar --port 9000
# 参数含义
taskmanager.heap.size    # flink社区版的该参数是worker的总内存,包括堆内存和direct memory(Network Buffer)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.kylinxue</groupId>
  <artifactId>FlinkExample</artifactId>
  <version>1.0-SNAPSHOT</version>

  <properties>
    <flink.version>1.7.0</flink.version>
    <scala.version>2.11.12</scala.version>
    <scala.binary.version>2.11</scala.binary.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
      <version>${flink.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-scala_2.11</artifactId>
      <version>${flink.version}</version>
    </dependency>
    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>fastjson</artifactId>
      <version>1.2.47</version>
    </dependency>
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-connector-kafka-0.10_${scala.binary.version}</artifactId>
      <version>${flink.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-streaming-scala_2.11</artifactId>
      <version>${flink.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
      <version>${flink.version}</version>
    </dependency>
    <dependency>
      <groupId>redis.clients</groupId>
      <artifactId>jedis</artifactId>
      <version>2.10.2</version>
    </dependency>
  </dependencies>

</project>

 

Flink核心概念

flink容错机制:分组标记栏barrier    checkpoint

flink乱序事件流:通过watermark

 

Core API :source --> transform --> sink

DataStream API

 

DataSet API

 

DataType和序列化

 

broadcast、accumulator、counter、distributed cache

 

状态管理

 

window和time

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值