78
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWSビッグデータソリューション Amazon Redshift, Amazon EMR, Amazon DynamoDBのご紹介 Yifeng Jiang Solutions Architect Amazon Data Services Japan TC-03 テクノロジートラック

TC-03 テクノロジートラック AWSビッグデータソリューション · AWSサービスの全体像–40以上のサービス AWSグローバルインフラ Region AZ Regions

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    AWSビッグデータソリューション Amazon  Redshift,  Amazon  EMR,  Amazon  DynamoDBのご紹介

    Yifeng  JiangSolutions  ArchitectAmazon  Data  Services  Japan

    TC-03 テクノロジートラック

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    アジェンダ

    1.  AWSのサービス全体像とビッグデータ関連サービス

    2.  解剖ビッグデータ3.  Getting  Started  with  Big  Data  Services

    –  Amazon  Redshift–  Amazon  Elastic  MapReduce–  Amazon  DynamoDB

    4.  Practical  Deep  Dive

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    アジェンダ

    1.  AWSのサービス全体像とビッグデータ関連サービス

    2.  解剖ビッグデータ3.  Getting  Started  with  Big  Data  Services

    –  Amazon  Redshift–  Amazon  Elastic  MapReduce–  Amazon  DynamoDB

    4.  Practical  Deep  Dive

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    AWSサービスの全体像  –  40以上のサービス

    AWSグローバルインフラRegions  /  Availability  Zones  /  Contents  Delivery  POPSAZ Region

    コンピュート処理理 ストレージ データベース

    EC2 ElasticLoad  Balancing

    Auto  Scaling S3 Glacier EBS Storage  Gateway RDS DynamoDB ElastiCache Redshift

    データ分析

    Kinesis EMR Data  Pipeline

    コンテンツ配信

    CloudFront

    ネットワーク Virtual  Private  Cloud Direct  Connect Rout53

    アプリケーションサービス

    WorkSpaces

    SQS SNS SES SWF Elastic  Transcoder CloudSearch

    Management  &  Administration

    CloudWatch CloudTrail IAM Management  Console SDK CLI

    ⾃自動化とデプロイメント

    CloudFormation BeanStalk OpsWorks

    EcosystemTechnology  Partner  /  Consulting  Partner  

    4

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Ingestion

    Storage

    Big  Data  services  on  AWS

    DWH NoSQL DynamoDB Redshift

    S3

    Glacier

    Data  Pipeline

    RDB

    Hadoop

    Workflow Management

    RDS

    Elastic  MapReduce

    5

    Kinesis

  • 分析やビッグデータもAWS〜~⼩小さく素早くはじめて、どこまでもスケールできます〜~

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Storage

    Big  Data  services  on  AWS

    DWH NoSQL DynamoDB Redshift

    S3

    Glacier

    Data  Pipeline

    RDB

    Hadoop

    Workflow Management

    RDS

    Elastic  MapReduce

    7

    Ingestion Kinesis

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Storage

    Big  Data  services  on  AWS

    DWH NoSQL DynamoDB Redshift

    S3

    Glacier

    Data  Pipeline

    RDB

    Hadoop

    Workflow Management

    RDS

    Elastic  MapReduce

    8

    Ingestion Kinesis

    本⽇日はこれらのサービスの役割や使い分け、組み合わせ⽅方をメインに取り上げていきます。

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    アジェンダ

    1.  AWSのサービス全体像とビッグデータ関連サービス

    2.  解剖ビッグデータ3.  Getting  Started  with  Big  Data  Services

    –  Amazon  Redshift–  Amazon  Elastic  MapReduce–  Amazon  DynamoDB

    4.  Practical  Deep  Dive

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    データ活⽤用の4つのステップ

    1.  あつめる–  多数のアプリケーションサーバーやクライアント、デバイスからのデータ収集

    2.  ためる–  安全でコスト効率率率よく、かつ利利⽤用しやすい形でデータを保存

    3.  処理理する–  抽出、除外、整形、いわゆる前処理理–  ⼀一次集計もここに含まれる

    4.  つかう–  BIツールで利利⽤用–  データをAPIで提供

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. Glacier RDS

    EMR

    EMR

    Redshift

    DynamoDB

    Data Pipeline

    S3

    Data

    ETL

    Sum

    Web app

    Analytics

    Dashboard

    11

    Kinesis

    あつめる ためる 処理する つかう

    データ活⽤用のステップで⾒見見る

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    1.1.1.1,  /login,      20140226000101,  …192.168…,  /home,    20140226011226,  …1.1.1.2,  /home,    20140226011331,  …

    EMRRedshift

    ETL済みデータS3

    ログ(オリジナル)S3

    処理理済みデータ

    Webサーバー

    ログ集約サーバー ETL

    例例:バッチ処理理によるアクセスログ集計USER            PATH              TIMESTAMP              -‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒USER1        /login              2014-‐‑‒02-‐‑‒26  00:00:01USER2        /home            2014-‐‑‒02-‐‑‒26  01:13:31

    12

    BIツールなど

    1.1.1.1,  /login,      20140226000101,  …192.168…,  /home,    20140226011226,  …1.1.1.2,  /home,    20140226011331,  …

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    USER1,      20140226000101,  …USER2,    20140226011226,  …USER1,    20140226011331,  …

    EMRRedshift

    ETL済みデータ

    S3ログ(オリジナル)

    S3処理理済みデータWebサーバー

    ログ集約サーバー

    例例:収集したデータの活⽤用  –DMP-‐‑‒

    13

    レポートツール

    データ提供API

    DynamoDBETL済みデータ

    USER1:  {  Interest:  [  ʻ‘Carʼ’,  ʻ‘Homeʼ’  ],  ...  }USER2:  {  Interest:  [  ʻ‘Dogʼ’,  ʻ‘Catʼ’  ],  …  }

    EMRS3

    処理理済みデータユーザーごとにログを集計して興味分野を分析する

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    データ活⽤用の4つのステップ

    1.  あつめる–  多数のアプリケーションサーバーやクライアント、デバイスからのデータ収集

    2.  ためる–  安全でコスト効率率率よく、かつ利利⽤用しやすい形でデータを保存

    3.  処理理する–  抽出、除外、整形、いわゆる前処理理–  ⼀一次集計もここに含まれる

    4.  つかう–  BIツールで利利⽤用–  データをAPIで提供

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    アジェンダ

    1.  AWSのサービス全体像とビッグデータ関連サービス

    2.  解剖ビッグデータ:  あつめる、ためる、つかう3.  Getting  Started  with  Big  Data  Services

    –  Amazon  DynamoDB、Amazon  Elastic  MapReduce、Amazon  Redshift

    4.  Practical  Deep  Dive–  現場で⾒見見かけるアーキテクチャ

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  Redshift

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  Redshift概要

    •  Data  Warehouse  as  a  Service  –  分析⽤用に整理理された⼤大量量の統合業務データの管理理サービス(フルマネージドサービス)

    •  拡張性:160GB〜~1.6PBまで拡張可能•  ⾼高速:カラムナ型、超並列列演算(MPP)•  低額:インスタンスの従量量課⾦金金(初期費⽤用、ライセンス費⽤用不不要)

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  Redshiftのアーキテクチャ

    18

    •  リーダーノードを経由してクエリーを実⾏行行

    •  インターフェイスはPostgreSQL互換(psqlで使えます)

    •  各コンピュートノードで演算が並列列実⾏行行

    •  各コンピュートノードにローカルストレージを保持

    BIツール

    リーダーノード

    コンピュートノード

    コンピュートノード

    コンピュートノード

    JDBC/ODBC

    10GigE  Mesh

    SQL  エンドポイント:•  クエリーの並列列化•  結果を⽣生成

    クエリー実⾏行行ノード•  “N”  スケールアウトを実現

    •  ローカルディスク

    S3,  DynamoDB,  EMRとの統合

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    アーキテクチャ:列列指向

    •  ⾏行行指向(RDBMS) •  列列指向(Redshift)orderid name price

    1 Book 100

    2 Pen 50

    n Eraser 70

    orderid name price

    1 Book 100

    2 Pen 50

    n Eraser 70

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. 20

    Amazon  Redshiftのノードタイプ•  dw2.large:

    –  CPU:  2  virtual  cores–  ECU:  7–  Memory:  15  GiB–  Storage:  160GB(SSD)–  Network:  0.2GB/s

    •  dw2.8xlarge–  CPU:  32  virtual  cores–  ECU:  104–  Memory:  244  GiB–  Storage:  2.56TB(SSD)–  Network:  3.7GB/s

    "   dw1.xlarge:•  CPU:  2  virtual  cores•  ECU:  4.4•  Memory:  15  GiB•  Storage:  2TB(HDD)•  Network:  0.3GB/s

    "   dw1.8xlarge•  CPU:  16  virtual  cores•  ECU:  35•  Memory:  120  GiB•  Storage:  16TB(SSD)•  Network:  2.4GB/s

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  S3からCSVファイルをロードしてみる

    21

    •  まずはRedshiftにログインpsql -d mydb –h YOUR_REDSHIFT_ENDPOINT -p 5439 -U awsuser -W !

    !COPY customer FROM 's3://data/customer.tbl.’ CREDENTIALS ’aws_access_key_id=KEY;aws_secret_access_key=SEC’ DELIMITER ‘,’ GZIP TIME_FORMAT ‘auto’; !

    •  Redshiftのシェルでcopyコマンド

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  Redshiftにログインしてデータロードしてクエリを掛けてみる

    22

    •  Redshiftのシェルでテーブルを定義CREATE TABLE nginx ( ! remote_addr char(15), ! time timestamp, ! request varchar(255), ! status integer, ! bytes bigint, ! ua varchar!); !

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    あとはいつものSQL

    23

    SELECT ua, request, COUNT(*) !FROM nginx!GROUP BY ua, request; !

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3へデータを書き出すのも簡単

    24

    UNLOAD TO ‘s3://YOUR_BUCKET/PATH/ !SELECT * FROM nginx; !

  • Tableau  +  Redshift

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  Redshiftとは・・・

    •  ⼤大量量のデータを⾼高速にSQLで処理理してくれる•  RDBと違いデータ量量が増えても性能が劣劣化しにくい•  ただし、あくまで分析⽤用データベースである•  データはETLや正規化されている必要がある•  集計や統計など、数値の可視化に有効

    レポートツール等,データ可視化に最適

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  Elastic  MapReduce

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Hadoop

    Elastic  MapReduce

    •  AWSが提供するマネージドHadoop•  Hadoop1系、2系、MapRが利利⽤用可能•  マネージド?

    •  クラスタの構築・監視・復復旧•  CloudWatchによるモニタリング•  S3のデータを扱える

    •  2つの⼤大きな特徴•  ワークフローマネジメント•  S3、DynamoDBのデータを扱える

    Hadoop

    ユーザーは普通のHadoopとして 利用できる

    28

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    ワークフローマネージメント:スクリプトでHadoopを起動

    29

    aws emr create-cluster \ !--name bigdata-handson \ !--ami-version 3.2.1 \ !--applications Name=Hive \ !--instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m1.large InstanceGroupType=CORE,InstanceCount=2,InstanceType=m1.large \ !--log-uri s3:/PATH/TO/LOG/ \ !--ec2-attributes SubnetId=subnet-a06474e6,KeyName=YOUR_KEY !

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. 30

    aws emr create-cluster \ !--name bigdata-handson \ !--ami-version 3.2.1 \ !--applications Name=Hive \ !--instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m1.large InstanceGroupType=CORE,InstanceCount=2,InstanceType=m1.large \ !--log-uri s3:/PATH/TO/LOG/ \ !--ec2-attributes SubnetId=subnet-a06474e6,KeyName=YOUR_KEY !

    名前をつける

    ワークフローマネージメント:スクリプトでHadoopを起動

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. 31

    aws emr create-cluster \ !--name bigdata-handson \ !--ami-version 3.2.1 \ !--applications Name=Hive \ !--instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m1.large InstanceGroupType=CORE,InstanceCount=2,InstanceType=m1.large \ !--log-uri s3:/PATH/TO/LOG/ \ !--ec2-attributes SubnetId=subnet-a06474e6,KeyName=YOUR_KEY !

    AMI(Hadoop)のバージョンを指定する

    ワークフローマネージメント:スクリプトでHadoopを起動

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. 32

    aws emr create-cluster \ !--name bigdata-handson \ !--ami-version 3.2.1 \ !--applications Name=Hive \ !--instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m1.large InstanceGroupType=CORE,InstanceCount=2,InstanceType=m1.large \ !--log-uri s3:/PATH/TO/LOG/ \ !--ec2-attributes SubnetId=subnet-a06474e6,KeyName=YOUR_KEY !

    インストールするアプリケーションを指定

    ワークフローマネージメント:スクリプトでHadoopを起動

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. 33

    aws emr create-cluster \ !--name bigdata-handson \ !--ami-version 3.2.1 \ !--applications Name=Hive \ !--instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m1.large InstanceGroupType=CORE,InstanceCount=2,InstanceType=m1.large \ !--log-uri s3:/PATH/TO/LOG/ \ !--ec2-attributes SubnetId=subnet-a06474e6,KeyName=YOUR_KEY !

    インスタンスタイプを指定

    ワークフローマネージメント:スクリプトでHadoopを起動

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. 34

    aws emr create-cluster \ !--name bigdata-handson \ !--ami-version 3.2.1 \ !--applications Name=Hive \ !--instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m1.large InstanceGroupType=CORE,InstanceCount=2,InstanceType=m1.large \ !--log-uri s3:/PATH/TO/LOG/ \ !--ec2-attributes SubnetId=subnet-a06474e6,KeyName=YOUR_KEY !

    ログの吐き出し先を指定

    ワークフローマネージメント:スクリプトでHadoopを起動

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. 35

    aws emr create-cluster \ !--name bigdata-handson \ !--ami-version 3.2.1 \ !--applications Name=Hive \ !--instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m1.large InstanceGroupType=CORE,InstanceCount=2,InstanceType=m1.large \ !--log-uri s3:/PATH/TO/LOG/ \ !--ec2-attributes SubnetId=subnet-a06474e6,KeyName=YOUR_KEY !

    VPCなどの情報を指定

    ワークフローマネージメント:スクリプトでHadoopを起動

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    さらに

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    仕事を予め定義して起動し、終わったら⾃自動削除

    37

    aws emr create-cluster \ !--name bigdata-handson \ !--ami-version 3.2.1 \ !--applications Name=Hive \ !--instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m1.large InstanceGroupType=CORE,InstanceCount=2,InstanceType=m1.large \ !--log-uri s3:/PATH/TO/LOG/ \ !--ec2-attributes SubnetId=subnet-a06474e6,KeyName=YOUR_KEY !--steps Type=HIVE,Name='Hive program’, Args=[-f,s3://PATH/TO/QUERY.q] \ !--auto-terminate !

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    cronやData  Pipelineでワークフローを制御すればHadoopのジョブを⾃自動化できる!

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3との連携

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3のデータを扱える

    •  HDFSとシームレスにS3上のデータを扱える•  INPUTやOUTPUTにs3://〜~を指定する

    40

    hadoop jar YOUR_JAR.jar \ !--src s3://YOUR_BUCKET/logs/ \ !--dest s3://YOUR_BUCKET/output/ !

    hadoop jar YOUR_JAR.jar \ !--src s3://YOUR_BUCKET/logs/ \ !--desct hdfs:///output/ !

    •  S3からデータを取り出して結果を更更にS3に吐き出す

    •  S3からデータを取り出して結果はローカルのHDFSに吐き出す

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    もちろんHiveでも

    CREATE EXTERNAL TABLE s3_as_external_table( !"user_id INT, !"movie_id INT, !"rating INT, !"unixtime STRING ) !

    ROW FORMAT DELIMITED FIELDS !TERMINATED BY '\t' !STORED AS TEXTFILE !LOCATION 's3://mybucket/tables/'; !

    41

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Hiveを使ったETL

    INSERT INTO TABLE table2 !SELECT ! column1, ! column2, ! column5, !FROM table1; ! !

    42

    ←例例えばtable1から  column3,4を除外したい

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    EMR  ちょっとDeep  Dive〜~RedshiftとEMRどちらを使う?〜~

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  Redshift

    •  基本的な使い勝⼿手はRDB•  SQLを使って解析•  BIツールのバックエンドとして•  ある程度度正規化されたデータが前提条件•  複雑なジョインも得意•  クラスタは基本的には起動しっぱなし

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  Elastic  MapReduce

    •  Hadoop•  MapReduce,  Hive,  Pig,  Hadoop  StreamingなどのHadoopのエコシステムが利利⽤用できる

    •  hiveでSQLっぽく使うこともできるがRedshiftのほうが速いし簡単

    •  正規化しづらいデータを扱うのが得意•  ⽴立立ちあげっぱなしではなく、ジョブごとにクラスタを起動して終了了した破棄する使い⽅方もできる

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    EMRかRedshiftか

    •  SQLを使った分析/解析ならRedshiftのほうが圧倒的に速い

    •  それ以外ならEMR

    ざっくり⾔言うと

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  Elastic  MapReduceとは・・・

    •  Hadoopを便便利利に利利⽤用できるようにしたサービスで⼤大量量のテキストデータを整形するのが⾮非常に得意

    •  ワークフローをうまく活⽤用すれば処理理の⾃自動が⽤用意•  S3のデータを⾃自在に扱える

    ⽣生ログのETLや⼀一次集計に強みを持つ

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  DynamoDB

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    DynamoDBとは

    •  NoSQL  as  a  Service

    •  データ量量が増えても性能が劣劣化しない

    •  ⼤大規模なデータを⾼高速に扱いたいときに真の価値を発揮

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    DynamoDBの特⻑⾧長

    •  管理理不不要で信頼性が⾼高い

    •  プロビジョンドスループット

    •  ストレージの容量量制限がない

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    特⻑⾧長1:管理理不不要で信頼性が⾼高い

    •  SPOFの存在しない構成•  データは3箇所の設備に保存されるので信頼性が⾼高い•  ストレージは必要に応じて⾃自動的にパーティショニングされる

    クライアント

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    特⻑⾧長2:プロビジョンドスループット

    •  テーブルごとにReadとWriteそれぞれに対し、必要な分だけのスループットキャパシティを割り当てる(=プロビジョンする)ことができる

    •  例例えば下記のようにプロビジョンする–  Read  :  1,000–  Write  :  100

    •  書き込みワークロードが上がってきたら–  Read  :  500–  Write  :  1,000

    •  この値はDB運⽤用中にオンラインで変更更可能

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    特⻑⾧長3:ストレージの容量量制限がない

    •  使った分だけの従量量課⾦金金制のストレージ

    •  データ容量量の増加に応じたディスクやノードの増設作業は⼀一切切不不要

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    DynamoDBの構成要素

    API

    SDK

    •  オペレーションはHTTPベースのAPIで提供されている•  ユーザーはコードを書くだけで利利⽤用できる

    Database

    Client  SideService  Side

    Client application

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    DynamoDBを使い始めるには

    1.  テーブルのKeyやIndexを決める-‐‑‒  カラムスキーマは決めなくていい

    2.  Read/Writeそれぞれのスループットを決める

    Thatʼ’s  it,  write  your  code!

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    DynamoDBのテーブルのプライマリキーの持ち⽅方は2種類

    •  Hash  key

    •  Hash  key  &  Range  key

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    プライマリキーがハッシュキーのサンプル1:ユーザー情報データベース

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    ユーザー情報データベースユーザーIDをプライマリキーとしたKVS的なテーブル

    –  UserIdで⼀一意のItemを特定し情報の参照や更更新、削除を⾏行行う

    UserId (Hash)

    Name Nicknames Mail Address Interests

    aed9d Bob [ Rob, Bobby ] [email protected] some address [ Car, Motor Cycle]

    edfg12 Alice [ Allie ]

    a8eesd Carol [ Caroline ]

    f42aed Dan [ Daniel, Danny ]

    Users Table

    ※DynamoDBにはauto_increment等でユニークIDを払い出す機能はないので注意。   UUIDなどを使ってください。

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    プライマリキーがハッシュ&レンジのテーブルサンプル:ゲームの⾏行行動履履歴管理理データベース

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    ゲームの⾏行行動履履歴管理理データベース

    User (Hash)

    Timestamp (Range)

    Opponent Result

    Alice 2014-02-21 12:21:20 Bob Lost

    Alice 2014-02-21 12:42:01 Bob Won

    Alice 2014-02-24 09:48:00 Dan Won

    Alice 2014-02-25 16:21:11 Charlie Won

    Battle History

    ⾃自分のバトル履履歴を確認するケースを想定–  Userに⾃自分(Alice)を指定し、更更にTimestampが7⽇日以内のデータをクエリしたりできる

    Charlie 02-25 16:21

    Won!

    Your Battle History

    Dan 02-24 09:48

    Won!

    Alice 02-21 12:42

    Won!

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    テーブル設計のための基礎知識識+1

    •  Local  Secondary  Index–  Range  key以外に絞り込み検索索のためのキーを持つことができる–  Hash  keyが同⼀一のアイテム群の中からの検索索のために利利⽤用–  インデックスもテーブルにプロビジョンしたスループットを利利⽤用する

    •  Global  Secondary  Index–  Hash  Keyをまたいで検索索を⾏行行うためのインデックス–  インデックスにテーブルとは独⽴立立したスループットをプロビジョンして利利⽤用する

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon  DynamoDBとは・・・

    •  分散型のNoSQL•  ⼤大量量のデータを投⼊入しても性能が劣劣化しない•  Redshiftとは違い、こちらはOLTP⽤用データベース•  SQLのようにJOINができるわけではない

    •  ⼤大量量のデータを格納しておいて、必要な少数のデータを⾼高速にやりとりするのに強みを持つ

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    アジェンダ

    1.  AWSのサービス全体像とビッグデータ関連サービス

    2.  解剖ビッグデータ:  あつめる、ためる、つかう3.  Getting  Started  with  Big  Data  Services

    –  Amazon  Redshift–  Amazon  Elastic  MapReduce–  Amazon  DynamoDB

    4.  Practical  Deep  Dive

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    AWS上でデータ処理理を⾏行行う際にはS3の利利⽤用がキー

    64

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Elastic  MapReduce

    DynamoDB Redshift

    S3

    データがS3にあればあとは必要に応じて処理理クラスタを起動して利利⽤用できる

    65

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3とEMR

    Hadoop単体ではデータ共有はできない↓

    ひとつのデータに対する処理理はひとつのクラスタに強く結合してしまう

    ↓キャパシティプランニングが難しい

    時間

    負荷

    66

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3とEMR

    S3

    時間

    負荷 キャパシティ

    データをHDFSではなくS3に格納しておけば・・

    67

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3とEMR

    S3

    S3上のデータを複数のクラスタから共⽤用できる

    ↓仕事量量に合わせて都度度

    クラスタを⽴立立ち上げて使える!

    時間

    負荷 キャパシティ

    68

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3とRedshift

    データ

    RedshiftへのデータロードはS3経由が効率率率的

    COPY table_name FROM ‘s3://hoge’CREDENTIALS ‘access_key_id:hoge…’DELIMITER ‘,’

    RedshiftS3

    69

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3とRedshift

    RedshiftからS3へのエクスポートやスナップショットも容易易

    RedshiftS3

    UNLOAD (‘SELECT * FROM…’)TO ‘s3://fuga/….’CREDENTIALS ‘access_key_id:hoge…’;

    70

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3とRedshift

    クラスタに問題が起こったら、S3からクラスタを再構築

    RedshiftS3

    71

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3とDynamoDB

    DynamoDB

    72

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    S3とDynamoDB

    古いデータはS3へオフロードもしくはバックアップ

    DynamoDBS3

    73

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    Amazon S3

    データ 分析

    Elastic MapReduce

    Redshift

    データ バックアップ

    EC2

    RDS

    Storage Gatewa

    y

    EBS

    Redshift

    コンテンツ 配信

    CloudFront

    データ アクセスGW

    Storage Gateway

    コンテンツ トランスコード

    Elastic Transcoder

    コンテンツ アーカイブ

    Glacier

    データ 交換

    Data Pipeline

    ⼤大事なことなのでもう⼀一度度。中⼼心にあるのはいつもS3

    74

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    まとめ

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    各サービスの役割を理理解し、うまく組み合わせる

    •  あつめる、ためる、処理理する、つかう、それぞれのフェーズに有効なサービスは異異なる。

    •  ⾃自分がどのフェーズのソリューションを必要としているのかを⾒見見極めてサービスを選ぶ。

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    モバイル

    S3

    DynamoDB

    RDS

    EMR

    EC2

    Redshift

    DynamoDB

    RDS

    サーバー

    各サービスの役割を理理解し、うまく組み合わせる

    つかう 処理する ためる あつめる

    どこから? どのくらい? どういう? どうやって?

  • ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    ありがとうございました