flume spark streaming配置详解
来源:互联网 发布:人机界面简单编程实例 编辑:程序博客网 时间:2024/05/01 05:47
Apache Flume是一个用来有效地收集,聚集和移动大量日志数据的分布式的,有效的服务。这里我们解释一下怎样配置Flume和Spark Streaming来从Flume获取数据,我们让flume直接将收集到的数据发送到spark streaming去处理
package com.pinganfu.flumesparkimport org.apache.spark.SparkConfimport org.apache.spark.storage.StorageLevelimport org.apache.spark.streaming.flume.FlumeUtilsimport org.apache.spark.streaming.{Milliseconds, StreamingContext}object SparkFlumeEvent{ def main(args: Array[String]) { val batchInterval = Milliseconds(5000) val sparkConf = new SparkConf().setAppName("flumetospark").setMaster("local[2]") val ssc = new StreamingContext(sparkConf, batchInterval) val stream = FlumeUtils.createStream(ssc,"localhost",33333, StorageLevel.MEMORY_AND_DISK) stream.count().map(cnt => "Received " + cnt + " flume events." ).print() ssc.start() ssc.awaitTermination() }}
Flume配置
a1.channels = c1a1.sinks = k1a1.sources = r1a1.sinks.k1.type = avroa1.sinks.k1.channel = c1a1.sinks.k1.hostname = localhosta1.sinks.k1.port = 33333 a1.sources.r1.type = netcata1.sources.r1.bind = localhosta1.sources.r1.port = 44444a1.sources.r1.channels = c1 a1.channels.c1.type = memorya1.channels.c1.capacity = 1000a1.channels.c1.transactionCapacity = 100
启动三个窗口
先启动spark-shell(引入两个依赖包)
bin/spark-shell --jars lib/spark-streaming-flume_2.10-1.0.0.jar,lib/flume-ng-sdk-1.6.0.jar
然后将上面代码贴进去
再启动flume
bin/flume-ng agent --conf conf --conf-file conf/flume.conf --name a1 -Dflume.root.logger=INFO,console
再启动telnet localhost 44444
发数据
截图如下: 0 0
- flume spark streaming配置详解
- Spark streaming and flume
- Spark-streaming 连接flume
- flume kafka spark streaming
- Spark学习笔记-Streaming-Flume
- Spark Streaming+Flume对接实验
- Spark Streaming + Flume Integration Guide
- flume-kafka- spark streaming(pyspark)
- spark Streaming flume poll 坑
- flume-kafka- spark streaming(pyspark)
- Spark学习笔记-Streaming集成Flume
- Spark Streaming 和 Flume-NG的整合
- Spark Streaming + Flume 相关源码阅读
- spark streaming+flume avro实时计算
- Spark Streaming+Flume对接实验(推送)
- flume+spark streaming+redis完整篇
- flume+kafka+spark streaming(持续更新)
- Spark Streaming和Flume的结合使用
- "Couldn't resolve host 'mirrors.aliyun.com'"
- 计算日期到天数转换
- js异步请求的几种方法
- Hadoop学习总结之三:Map-Reduce入门
- VNC源码研究(二十四)vnc-4.0-winsrc版本之winvnc工程分析
- flume spark streaming配置详解
- 设置linux 可以访问外网
- IOS端cordova项目 报错:permisson denied
- 【转】java中调用cmd命令(cmd /c 和 cmd/k)获得当前目录绝对路径
- Servlet生命周期与工作原理
- libCEF中C++与JavaScript的交互调用【编程语言】
- 当系统存在多个Launcher时,如何设置开机自动进入默认的Launcher?
- 台湾国立大学机器学习基石.听课笔记(第十一讲):Linear Models of Classification
- HDUOJ_2544(最短路)(SPFA)