Data Analysis with EMR.

Video demo: Run Spark Application(Scala) on Amazon EMR (Elastic MapReduce) cluster【EMR 5.3.1】

一个实战为王的年代,嘿嘿嘿~

数据分析的一般过程

步骤 1:设置示例集群的先决条件

创建 Amazon S3 存储桶

创建 Amazon EC2 密钥对

步骤 2:启动示例 Amazon EMR 集群

Goto: Create Cluster - Quick Options

关于服务器型号的选择,参见:[AWS] EC2 & GPU

名词解释

Spark 2.4.3 on Hadoop 2.8.5

YARN with Ganglia 3.7.2 and Zeppelin 0.8.1

    • Ganglia 是UC Berkeley发起的一个开源集群监视项目,设计用于测量数以千计的节点。
    • Zeppelin 是一个Web笔记形式的交互式数据查询分析工具,可以在线用scala和SQL对数据进行查询分析并生成报表。

Cluster 控制台

/* 需要找个教程全面学习下 */

在 Network and hardware (网络和硬件) 下,查找 Master (主) 和 Core (核心) 实例状态。

集群创建过程中,状态将经历 Provisioning (正在预置) 到 Bootstrapping (正在引导启动) 到 Waiting (正在等待) 三个阶段。

一旦您看到 Security groups for Master (主节点的安全组) 和 Security Groups for Core & Task (核心与任务节点的安全组) 对应的链接,即可转至下一步,但您可能需要一直等到集群成功启动且处于 Waiting (正在等待) 状态。

步骤 3:允许从客户端到集群的 SSH 连接

进入master的ec2主机,然后通过ssh登录。

记得在 Security Group 中修改配置,支持ssh。

步骤 4:通过以步骤形式运行 Hive 脚本来处理数据

关于准备数据集,参见:[AWS] S3 Bucket

步骤 5:清理资源

需终止集群并删除 Amazon S3 存储桶以免产生额外费用。

经验谈

一、Medicaid Dataset

数据比较大,如何预处理大数据。

Ref: Preprocessing data with Scalding and Amazon EMR

传统方案的弊端 - Local Pandas

the possiblity of building a model to predict the probability of chronic disease given the claim codes for a patient. Pandas over IPython was okay for doing analysis with a subset (single file) of data, but got a bit irritating with the full dataset because of frequent hangs and subsequent IPython server restarts.

预测一个病人是否患有这个疾病,是个预测模型。

Pandas适合将一个单独的表作为输入,数据过多容易导致系统崩溃。

代码展示:Medicaid Dataset - Basic Data Analysis of Benefit Summary Data

对数据集内容做了大概的了解。

大数据方案 - AWS EMR

This post describes a mixture of Python and Scala/Scalding code that I hooked up to convert the raw Benefits and Inpatient Claims data from the Medicare/Medicaid dataset into data for an X matrix and multiple y vectors, each y corresponding to a single chronic condition. Scalding purists would probably find this somewhat inelegant and prefer a complete Scalding end-to-end solution, but my Scalding-fu extends only so far - hopefully it will improve with practice.

二、大数据处理综述

From: Data Processing and Text Mining Technologies on Electronic Medical Records: A Review

Abstract

应用之潜力:Currently, medical institutes generally use EMR to record patient’s condition, including diagnostic information, procedures performed, and treatment results. EMR has been recognized as a valuable resource for large-scale analysis.

存在的问题:However, EMR has the characteristics of diversity, incompleteness, redundancy, and privacy, which make it difficult to carry out data mining and analysis directly.

预处理魔力:Therefore, it is necessary to preprocess the source data in order to improve data quality and improve the data mining results.

Different types of data require different processing technologies.

结构化数据:Most structured data commonly needs classic preprocessing technologies, including data cleansing, data integration, data transformation, and data reduction.

非结构化化:For semistructured or unstructured data, such as medical text, containing more health information, it requires more complex and challenging processing methods.

The task of information extraction for medical texts mainly includes NER (named-entity recognition) and RE (relation extraction).

This paper focuses on the process of EMR processing and emphatically analyzes the key techniques. In addition, we make an in-depth study on the applications developed based on text mining together with the open challenges and research issues for future work.

非常好的一篇文章,拿出一个案例为样品对大数据处理的各个流程做了阐述。

有时间不妨细看下。

方案对比

一、AWS Big Data Blog

一些新技术阐述:AWS Big Data Blog

很好的代码样例:https://github.com/aws-samples/aws-big-data-blog

一个经典的案例:Nasdaq’s Architecture using Amazon EMR and Amazon S3 for Ad Hoc Access to a Massive Data Set

RedShift

The Nasdaq Group has been a user of Amazon Redshift since it was released and we are extremely happy with it. We’ve discussed our usage of that system at re:Inventseveral times, the most recent of which was FIN401 Seismic Shift: Nasdaq’s Migration to Amazon Redshift. Currently, our system is moving an average of 5.5 billion rows into Amazon Redshift every day (14 billion on a peak day in October of 2014).

可见数据量非常庞大且高频。

Why Amazon S3 and Amazon EMR?

We can avoid these problems by using Amazon S3 and Amazon EMR, allowing us to separate compute and storage for our data warehouse and scale each independently.

Data Ingest Workflow

/* 略,没啥意思 */

二、Glue + Athena

From: 使用 AWS Glue 和 Amazon Athena 实现无服务器的自主型机器学习

目的

使用 AWS Glue 提取位于 Amazon S3 上有关出租车行驶情况的数据集,

并使用 K-means 根据行车坐标将数据分成 100 个不同的集群。

然后,我会使用 Amazon Athena 查询行驶次数和每个集群的大概区域。

最后,我会使用 Amazon Athena 来计算行驶次数最多的四个区域的坐标。

使用 AWS Glue 和 Amazon Athena 都可以执行这些任务,无需预置或管理服务器。

基本思路

该脚本使用 Spark 机器学习 K-means 集群库,基于坐标划分数据集。

该脚本通过加载绿色出租车数据并添加指示每一行被分配到哪个集群的列来执行作业。

该脚本采用 parquet 格式将表保存到 Amazon s3 存储桶 (目标文件)。

可以使用 Amazon Athena 查询存储桶。

执行 AWS Glue 作业

Glue抓取数据,然后kmean后将结果保存在S3中。

然后通过Athena做一些简单的查询。

问题来了:pySpark.kmean是否 base on EMR。

结论:

  先把glue用熟,积累一些简单的pipeline的处理经验后,再进阶使用emr处理复炸的Pipeline,或者也就是自定义搭建复杂pipeline。

End.

[AWS] 02 - Pipeline on EMR的更多相关文章

  1. 【redis 学习系列08】Redis小功能大用处02 Pipeline、事务与Lua

    3.Pipeline 3.1 Pipeline概念 Redis客户端执行一条命令分为如下四个过程: (1)发送命令 (2)命令排队 (3)命令执行 (4)返回结果 其中(1)和(4)称为Round T ...

  2. [AI] 深度数据 - Data

    Data Engineering Data  Pipeline Outline [DE] How to learn Big Data[了解大数据] [DE] Pipeline for Data Eng ...

  3. [Unity3D] 05 - Access to DB or AWS

    可以选择连接本地服务器,或者云服务器. 参考源代码 : https://www.cnblogs.com/wuzhang/p/wuzhang20141202.html (1) 功能:点击一下按键,然后访 ...

  4. AWS产品目录

    计算 Amazon EC2:弹性虚拟机 AWS Batch:批处理计算 Amazon ECR:Docker容器管理 Amazon ECS:高度可扩展的快速容器管理服务 Amazon EKS:在AWS上 ...

  5. aws产品整理

    计算 Amazon EC2:弹性虚拟机 AWS Batch:批处理计算 Amazon ECR:Docker容器管理 Amazon ECS:高度可扩展的快速容器管理服务 Amazon EKS:在AWS上 ...

  6. AWS 数据分析服务(十)

    Amazon Kinesis 概念 处理AWS上大量流数据的数据平台 Kinesis Streams 用于搜集数据,Client Library 用于分析后的展示 构建用于处理或分析流数据的自定义应用 ...

  7. AWS 数据库(七)

    数据库概念 关系型数据库 关系数据库提供了一个通用接口,使用户可以使用使用 编写的命令或查询从数据库读取和写入数据. 关系数据库由一个或多个表格组成,表格由与电子表格相似的列和行组成. 以行列形式存储 ...

  8. drone的pipeline原理与代码分析

    最近的一个项目,需要实现一个工作任务流(task pipeline),基于之前CICD的经验,jenkins pipeline和drone的pipeline进入候选. drone是基于go的cicd解 ...

  9. Aws Dynamodb数据导出到S3

    本节将描写叙述怎样从一个或多个DynamoDB的表导出数据到S3的bucket中.在运行导出之前你须要提前创建好S3的bucket. 注意 假设你还没有使用过AWS Data Pipeline,在运行 ...

随机推荐

  1. 礼盒抖动动画(CocosCreator)

    推荐阅读:  我的CSDN  我的博客园  QQ群:704621321       这个月还有一天了,别问我为什么是一天,996,懂吗?项目是做不完了,策划又加新功能,又不能安静的改bug了.又是动画 ...

  2. 拖动水滴给土地浇水(CocosCreator)

    推荐阅读:  我的CSDN  我的博客园  QQ群:704621321 一.前沿       最近在做农场的模块,需要实现拖动水滴图标(

  3. Servlet 常用API学习(一)

    Servlet常用API学习 一.Servlet体系结构(图片来自百度图片) 二.ServletConfig接口 Servlet在有些情况下可能需要访问Servlet容器或借助Servlet容器访问外 ...

  4. Vue 应用 nginx 配置 前后端不分离模式

    一.先在官网下载nginx 软件,解压后放在软件盘中如D盘 将nginx 文件夹拖到编译器中,打开conf 文件夹中的 nginx.conf 文件,找到其中的server {} 配置项,默认35 行. ...

  5. 如何理解JS中this指向的问题

    首先,用一句话解释this,就是:指向执行当前函数的对象. 当前执行,理解一下,也就是说this的指向在函数定义的时候是确定不了的,只有函数执行的时候才能确定.this到底指向谁?this的最终指向的 ...

  6. Dart语法学习

    Dart语法学习 目录 参考资料 语言特性 关键字 变量与常量 数据类型 运算符 operators 控制流程语句 异常 Exceptions 函数 Function 类 Class 类-方法 类-抽 ...

  7. 独家解读 etcd 3.4版本 |云原生生态周报 Vol. 18

    作者 | 酒祝.墨封.宇慕.衷源 关注"阿里巴巴云原生"公众号,回复关键词 "资料" ,即可获得 2019 全年 meetup 活动 PPT 合集及 K8s 最 ...

  8. HTML(五)列表,区块,布局,表单和输入

    HTML 列表 无序列表 Coffee Tea Milk 默认是圆点,也可以 圆圈 正方形 有序列表 Coffee Tea Milk Coffee Tea Milk 默认是用数字排序 大写字母 小写字 ...

  9. CF1027D Mouse Hunt 思维

    Mouse Hunt time limit per test 2 seconds memory limit per test 256 megabytes input standard input ou ...

  10. Kafka笔记—可靠性、幂等性和事务

    这几天很忙,但是我现在给我的要求是一周至少要出一篇文章,所以先拿这篇笔记来做开胃菜,源码分析估计明后两天应该能写一篇.给自己加油~,即使没什么人看. 可靠性 如何保证消息不丢失 Kafka只对&quo ...