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. .NET Core 单元测试

    应用程序测试的类型很多,包括集成测试,Web 测试,负载测试等.在最底层的是单元测试,此测试可以测试单个软件组件或方法.单元测试一般只测试开发人员的代码,不应该测试基础结构普.问题,如数据库,文件系统 ...

  2. Docker学习总结(七)--Docker私有仓库

    创建私有仓库 1) 拉取私有仓库镜像 docker pull registry 2)启动私有仓库容器 docker run -di --name-registry -p 5000:5000 regis ...

  3. unity编辑器扩展_01(在工具栏中创建一个按钮)

    代码: [MenuItem("Tools/Test",false,1)]    static void Test()    {        Debug.Log("tes ...

  4. unity_小功能实现(客户端相互通信功能)

    服务器端:在VS中新建项目,用于服务器的搭建 using System;using System.Collections.Generic;     using System.Net.Sockets;u ...

  5. C++微信网页协议实现和应用

    微信推送报警消息实现 目录 1      前言... 2 1.1     背景... 2 1.2     现有技术对比... 2 2      总体流程... 2 3      微信网页接口解析... ...

  6. 学测试,看视频?NONONO,除非这种情况

    001 前言 : 很久没周末写文章了,一个是要睡懒觉.另外一个是,周末写了大家也没有心思看(加班1周了,好不容易周末,你又让我学习 ?先睡个懒觉再说,去TM的学习). 然而,今天早早的5点就起床了,处 ...

  7. 导航页的开发--手机web app开发笔记

    好了,的所有的基础知识已经准备完毕了,现在开始制作引导页.这个引导页需要一个HTML文件,JS文件,一个CSS文件.在HBuilderX中根目录下添加“Guid.html”,在JS文件夹添加“myth ...

  8. [Python] 用python做一个游戏辅助脚本,完整思路

    一.说明 简述:本文将以4399小游戏<宠物连连看经典版2>作为测试案例,通过识别小图标,模拟鼠标点击,快速完成配对.对于有兴趣学习游戏脚本的同学有一定的帮助. 运行环境:Win10/Py ...

  9. Navicat for mysql建立连接

    1. 安装Navicat for MySQL. 2. 点击连接->MySQL,打开SSH,填写主机名.端口.用户名.密码. 3. 连接->打开常规,设置连接名(可以自由指定).主机名.端口 ...

  10. 2019nc#7

    题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A String 点击查看 进入讨论 566/3539  通过 B Irreducible Polynomial 点击查看 规律 730/229 ...