![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spark
Spark入门笔记
豪华手抓饼
这个作者很懒,什么都没留下…
展开
-
Spark Streaming 03 分布式消息队列 kafka
1 概述Kafka® is used for building real-time data pipelines and streaming apps. It is horizontally scalable, fault-tolerant, wicked fast, and runs in production in thousands of companies.● Building re...原创 2019-02-02 09:39:34 · 318 阅读 · 0 评论 -
Spark Streaming 实战 日志分析(二)数据可视化
1 需求使用echarts可视化工具将之前统计好的数据进行展示。2 开发环境IDEA+mavenspring boot + ECharts3 编程代码地址1)pom.xml,添加依赖<repositories> <repository> <id>cloudera</id>原创 2018-09-06 22:15:02 · 1865 阅读 · 0 评论 -
Spark Streaming 实战 日志分析(一)数据清洗+统计访问量
1 项目需求1)需求统计今天到目前为止的访问量统计今天到目前为止从搜索引擎过来的课程的访问量2)开发环境与技术选型IDEA+mavenflume+kafka+HBase3)安装配置 HBase下载、解压、配置环境变量配置文件conf/hbase-env.sh修改JAVA_HOMEexport HBASE_MANAGES_ZK=falsecon...原创 2018-09-06 16:08:01 · 5031 阅读 · 1 评论 -
Spark Streaming 12 spark streaming&flume&kafka打造通用流处理平台
1 处理流程2 模拟日志产生1)log4j.propertieslog4j.rootLogger=INFO,stdout,flumelog4j.appender.stdout = org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.target = System.outlog4j.appender.stdout.lay...原创 2018-09-05 16:16:41 · 277 阅读 · 0 评论 -
Spark Streaming 11 Spark Streaming整合kafka(二)Direct approach
1)KafKaDirectWC.scalapackage com.lihaogn.sparkKafkaimport kafka.serializer.StringDecoderimport org.apache.spark.SparkConfimport org.apache.spark.streaming.kafka.KafkaUtilsimport org.apache.spar...原创 2018-09-05 09:51:38 · 175 阅读 · 0 评论 -
Spark Streaming 10 Spark Streaming整合kafka(一)Receiver-based
代码地址1 添加依赖<dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-streaming-kafka-0-8_2.11</artifactId> <ver原创 2018-09-05 09:21:19 · 329 阅读 · 0 评论 -
Spark Streaming 09 Spark Streaming整合flume(二)pull 方式
1 添加flume配置文件 flume-pull-streaming.conf# Name the components on this agentsimple-agent.sources = netcat-sourcesimple-agent.sinks = spark-sinksimple-agent.channels = memory-channelsimple-agent.s...原创 2018-09-05 08:22:05 · 211 阅读 · 0 评论 -
Spark Streaming 08 Spark Streaming整合flume(一)push 方式
代码地址1)添加flume-push-streaming.conf配置文件# Name the components on this agentsimple-agent.sources = netcat-sourcesimple-agent.sinks = avro-sinksimple-agent.channels = memory-channelsimple-agent.so...原创 2018-09-05 07:48:50 · 128 阅读 · 0 评论 -
Spark Streaming 07 Spark Streaming 进阶
代码地址1 updateStateByKey算子使用 The updateStateByKey operation allows you to maintain arbitrary state while continuously updating it with new information. 1)StatefulWordCount.scalapackage com.li...原创 2018-09-04 17:09:47 · 114 阅读 · 0 评论 -
Spark Streaming 06 Spark Streaming 核心
1 概念1.1 Initializing StreamingContext To initialize a Spark Streaming program, a StreamingContext object has to be created which is the main entry point of all Spark Streaming functionality.1...原创 2018-09-04 11:39:50 · 170 阅读 · 0 评论 -
Spark Streaming 05 Spark Streaming 入门
1 介绍 Spark Streaming is an extension of the core Spark API that enables scalable, high-throughput, fault-tolerant stream processing of live data streams. spark-streaming将来自不同的数据源的数据进行处理,之后将结果输出...原创 2018-09-04 09:55:57 · 149 阅读 · 0 评论 -
Spark Streaming 04 整合flume&kafka完成数据采集
1)配置文件 flume/conf/avro-memory-kafka.conf# Name the components on this agentavro-memory-kafka.sources = avro-sourceavro-memory-kafka.sinks = kafka-sinkavro-memory-kafka.channels = memory-channel...原创 2018-09-03 16:09:05 · 214 阅读 · 0 评论 -
Spark Streaming 02 分布式日志收集框架flume
1 介绍1.1 产生背景如何解决数据从其他server移动到hadoop之上。1.2 概述 Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts of log data. 1)设计目标...原创 2018-09-02 21:06:02 · 195 阅读 · 0 评论 -
Spark Streaming 01 初识实时流处理
1 产生背景:时效性高数据量大2 离线计算与实时计算对比:1)数据来源离线:HDFS 历史数据,数据量大实时:消息队列(kafka),实时新增、修改记录过来的数据2)处理过程离线:MapReduce:map+reduce实时:spark(DStream/SS)3) 处理速度离线:慢实时:快速4)进程离线:启动+销毁实时:7*2...原创 2018-09-02 20:29:18 · 149 阅读 · 0 评论 -
Spark 11 Spark SQL 实战:日志分析(四)spark on yarn
1 介绍在spark中,支持4种运行模式:local:开发时使用standalone:spark自带,如果一个集群时standalone的话,就需要在多台机器上同时部署spark环境。yarn:建议在生产上使用该模式,统一使用yarn进行整个集群作业(MR,spark)的资源调度。mesos注意:不管使用什么模式,spark应用程序的代码是一模一样的spark支持可插...原创 2018-09-02 08:56:27 · 646 阅读 · 0 评论 -
Spark 10 Spark SQL 实战:日志分析(三)结果可视化
1 使用ECharts可视化框架1)基本使用ECharts使用教程2)静态测试将下载下来的文件echarts.min.js放在js文件夹下在webapp下创建test.htmltest.html<!DOCTYPE html><html lang="en"><head> <meta原创 2018-09-01 17:23:47 · 2152 阅读 · 0 评论 -
Spark 09 Spark SQL 实战:日志分析(二)实现需求
1 需求统计最受欢迎的课程TopN访问次数按地市统计最受欢迎的TopN课程按流量统计最受欢迎的TopN课程2 在MySQL中创建数据库、创建表// 创建数据库create database sparkSql_project;// 创建表create table day_vedio_access_topn_stat( day varchar(8) not nu...原创 2018-09-01 12:01:25 · 620 阅读 · 0 评论 -
Spark 08 Spark SQL 实战:日志分析(一)介绍、数据清洗
1 离线数据处理流程1)数据采集Flume:web日志写入到HDFS2)数据清洗脏数据处理可以使用Spark、Hive、MapReduce清洗完之后数据可以放在HDFS3)数据处理按照需求进行业务统计和分析使用Spark、Hive、MapReduce或者其他分布式计算框架4)处理结果入库结果存放在RDBMS、NoSQL5)数据可视化通...原创 2018-08-30 21:39:20 · 8667 阅读 · 15 评论 -
Spark 07 SparkSQL操作外部数据
1 概述1)产生背景every spark application starts with loading data and ends with saving data.loading and saving data is not easy.datasets stored in various formats/system.2)目标:easy loading/saving Da...原创 2018-08-29 11:03:16 · 249 阅读 · 0 评论 -
Spark 06 DataFrame&DataSet
1 概述 A Dataset is a distributed collection of data. A DataFrame is a Dataset organized into named columns.Dataset:分布式数据集 DataFrame:以列(列名,列的类型,列值)的形式构成的分布式数据集1)DataFrame和RDD对比RDD:jav...原创 2018-08-28 20:40:55 · 159 阅读 · 0 评论 -
Spark 05 spark-shell 使用
1 spark-shell1)将hive-site.xml文件复制到spark/conf/中,实现spark访问hive2)启动spark-shellspark-shell --master local[2]orspark-shell --jars jar包 --master local[2]使用spark.sql("sql 语句").show4)启动spark-sql...原创 2018-08-28 10:33:46 · 1000 阅读 · 0 评论 -
Spark 04 Spark SQL 使用
1 SQLContext的使用Spark1.x中Spark SQL的入口:SQLContext The entry point into all functionality in Spark SQL is the SQLContext class, or one of its descendants. To create a basic SQLContext, all you need...原创 2018-08-27 21:58:54 · 174 阅读 · 0 评论 -
Spark 03 Spark SQL 概述
Spark SQL is a Spark module for structured data processing.1)为什么需要SQL事实上的标准易学易用受众面大2)特点 1) Integrated Seamlessly mix SQL queries with Spark programs. Spark SQL lets you query s...原创 2018-08-27 20:33:54 · 187 阅读 · 0 评论 -
Spark 02 安装配置(环境搭建)、编译
1 环境搭建1)下载解压软件包第一种方式:下载可执行tar包,直接解压第二种方式:下载源码包,编译后解压2)配置环境变量1.1 local模式1)启动spark-shellspark-shell --master local[2]1.2 standalone模式Spark Standalone模式的架构和Hadoop HDFS/YARN很类似:1 master...原创 2018-08-27 15:14:06 · 268 阅读 · 0 评论 -
Spark 01 概述
1)介绍 Apache Spark™ is a unified analytics engine for large-scale data processing.快速通用的处理大规模数据的引擎。2)产生背景MapReduce局限性1)代码繁琐 2)只能够支持map和reduce方法 3)执行效率低下 4)不适合迭代多次、交互式、流式的处理框架多样化1)批处理...原创 2018-08-27 11:15:02 · 201 阅读 · 0 评论