Spark-Flume整合--Pull
来源:互联网 发布:成都知美术馆各种图 编辑:程序博客网 时间:2024/05/16 19:46
第二种sparkStreaming 整合Flume
flume采用 netcat-memory-customer sink架构
本地测试
1:本地启动sprakStreaming服务,(192.168.145.128 10000)
2. 服务器中启动flume agent
3. telnet往端口中输入数据,观察本地idea控制台输出数据
服务器测试
mvn打包:mvn clean package -DskipTests
上传至服务器
先启动flume
flume-ng agent \ --name netcat-memory-avro \ --conf $FLUME_HOME/conf \ --conf-file $FLUME_HOME/conf/netcat-memory-avro.conf \ -Dflume.root.logger=INFO,console
后启动spark
spark-submit \--class com.tuzhihai.flumespark.SparkPullFlume \--master local[2] \--packages org.apache.spark:spark-streaming-flume_2.11:2.2.0 \/root/soft_down/lib/sparklearn-1.0.jar \192.168.145.128 10000
在端口输入数据
telnet 192.168.145.128 9990
观察flume控制台
pull方式为什么要先启动flume后启动spark?
首先说明,pull方式比push方式更加可靠,在实际工作中应用极多。
pull方式是flume采集到数据后存储在一个Agent中,然后spark想要数据的时候,直接从这个Agent中pull就ok了。这个方式明显更加友好,更加符合工作要求,不是你主动传给我,而是我想要的时候我自己从你那拿。
spark-pull-flume.conf
flume-ng agent \ --name netcat-memory-spark \ --conf $FLUME_HOME/conf \ --conf-file $FLUME_HOME/conf/spark-pull-flume.conf \ -Dflume.root.logger=INFO,console # example netcat-memory-sparknetcat-memory-spark.sources = netcat-sourcenetcat-memory-spark.sinks = spark-sinknetcat-memory-spark.channels = memory-channel# Describe/configure the sourcenetcat-memory-spark.sources.netcat-source.type = netcatnetcat-memory-spark.sources.netcat-source.bind = 192.168.145.128netcat-memory-spark.sources.netcat-source.port = 9999# Describe/ the sinknetcat-memory-spark.sinks.spark-sink.type = org.apache.spark.streaming.flume.sink.SparkSinknetcat-memory-spark.sinks.spark-sink.hostname = 192.168.145.128netcat-memory-spark.sinks.spark-sink.port = 10000# Use a channel which buffers events in memorynetcat-memory-spark.channels.memory-channel.type = memory# Bind the source and sink to the channelnetcat-memory-spark.sources.netcat-source.channels = memory-channelnetcat-memory-spark.sinks.spark-sink.channel = memory-channel
阅读全文
0 0
- Spark-Flume整合--Pull
- Spark streaming整合Flume之pull方式
- flume-Spark整合-push方式
- SparkStreaming整合Flume(二)Pull方式的整合
- Spark Streaming 和 Flume-NG的整合
- Spark和Flume-ng的整合
- Spark streaming整合flume之Push方式
- Spark Streaming从Flume读取数据流(pull模式)
- Spark Streaming整合Flume&Kafka打造通用流处理基础
- Flume+Kakfa+Spark Streaming整合(运行WordCount小例子)
- Spark + Flume
- Spark + Flume
- Spark Streaming + Flume整合官网文档阅读及运行示例
- Spark Streaming + Flume整合官网文档阅读及运行示例
- Spark streaming and flume
- Flume结合Spark测试
- Spark-streaming 连接flume
- flume kafka spark streaming
- 第13周项目3- 是否二叉排序树?
- Scene-based Shack–Hartmann波前探测:仿真与分析
- Java类加载器概述
- android与h5交互
- 停止终端工作
- Spark-Flume整合--Pull
- 第二周项目 2—C/C++语言中函数参数传递的三种方式
- tf.train.noisy_linear_cosine_decay
- C求十个数中的最大值
- Python学习Day3
- Python实现Non-unique Elements详解
- Django 之----模版的使用
- 机器学习实战第7章-Adaboost
- 当程序员没了互联网,该如何继续学习写代码