AWS
ビッグデータソリューション
Amazon Redshift, Amazon EMR, Amazon DynamoDBご紹介
Yuta Imai
Solutions Architect
Amazon Data Services Japan
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved. ©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
フィードバックをお寄せ下さい
本イベントについてツイートされる際は
、
ハッシュタグをご利利⽤用ください
。
#AWSRoadshow
お帰りになる前には
、
アンケートへのご協⼒力力をお願いします
。
引換⽤用の記念念品をご⽤用意しています
。
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
⾃自⼰己紹介
•
名前
今井 雄太 (いまい ゆうた)
•
所属
アマゾンデータサービスジャパン
ソリューションアーキテクト
•
仕事
広告業界
、
ゲーム業界のお客様を担当
50ms or dieなWebサービスの技術全般
4
アジェンダ
1.
AWSのサービス全体像と
ビッグデータ関連サービス
2.
解剖ビッグデータ
3.
Getting Started with Big Data Services
–
Amazon Redshift
–
Amazon Elastic MapReduce
–
Amazon DynamoDB
©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
AWSサービスの全体像
AWSグローバルインフラ
Regions / Availability Zones / Contents Delivery POPS
AZ
Region
コンピュート処理理
ストレージ
データベース
EC2 Elastic
Load BalancingAuto 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
Ecosystem
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Interface
Storage
Big Data services on AWS
DWH
NoSQL
DynamoDB
Redshift
S3
Glacier
Data Pipeline
RDB
Hadoop
Workflow
Management
RDS
Elastic
MapReduce
8
Kinesis
AWSビッグデータサービス群
Amazon Simple Storage Service(S3)
Amazon Glacier(Glacier)
•
容量量制限がなく
、
利利⽤用分だけの⽀支払い
で利利⽤用できるストレージ
•
データの耐久性は99.999999999%
•
静的HTTPサーバーとしても利利⽤用可
•
S3と同等のデータ耐久性
•
S3の1/3の価格で利利⽤用可能なストレージ
•
データの取り出しリクエストからアクセ
ス可能になるまで約4時間かかる
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWSビッグデータサービス群
Amazon DynamoDB(DynamoDB)
Amazon Redshift(Redshift)
•
NoSQL as a Service
•
ストレージ容量量の制限なし
•
必要なスループットをプロビジョンして利利⽤用
•
マネージドData Ware House
•
EC2やRDSと同じように使った分だけの課⾦金金
•
スケールアウト/インも容易易
Amazon RDS(RDS)
•
マネージドRelational Database
•
PostgreSQL,MySQL,Oracle,SQL Serverか
らエンジンを選択可能
AWSビッグデータサービス群
Amazon Elastic MapReduce(EMR)
Amazon Kinesis(Kinesis)
•
マネージドHadoop
•
HDFSとシームレスにS3を扱える
•
Stream Computingのためのサービス
•
ストリーミングMapReduceのようなこと
を容易易に可能にしてくれる
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWSビッグデータサービス群
AWS Data Pipeline(Data Pipeline)
•
データの移動やETLのバッチ処理理/
パイプライン処理理のためのオーケ
ストレーションサービス
Interface
Storage
Big Data services on AWS
DWH
NoSQL
DynamoDB
Redshift
S3
Glacier
Data Pipeline
RDB
Hadoop
Workflow
Management
RDS
Elastic
MapReduce
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
14
Interface
Kinesis
Storage
Big Data services on AWS
DWH
NoSQL
DynamoDB
Redshift
S3
Glacier
Data Pipeline
RDB
Hadoop
Workflow
Management
RDS
Elastic
MapReduce
Interface
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つのステップ
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
18
Kinesis
あつめる
ためる
処理する
つかう
データ活⽤用のステップで⾒見見る
1.1.1.1, /login, 20140226000101, … 192.168…, /home, 20140226011226, … 1.1.1.2, /home, 20140226011331, …
EMR
ETL済みデータRedshift
S3
ログ(オリジナル) 処理理済みデータ
S3
Webサーバー
ログ集約サーバー
ETL
例例:バッチ処理理によるアクセスログ集計
USER PATH TIMESTAMP -‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒-‐‑‒ USER1 /login 2014-‐‑‒02-‐‑‒26 00:00:01 USER2 /home 2014-‐‑‒02-‐‑‒26 01:13:31
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, …
EMR
ETL済みデータRedshift
S3
ログ(オリジナル)S3
処理理済みデータWebサーバー
ログ集約サーバー
例例:収集したデータの活⽤用
–DMP-‐‑‒
20
レポートツール
データ提供API
DynamoDB
ETL済みデータUSER1: { Interest: [ ʻ‘Carʼ’, ʻ‘Homeʼ’ ], ... } USER2: { Interest: [ ʻ‘Dogʼ’, ʻ‘Catʼ’ ], … }
EMR
処理理済みデータS3
ユーザーごとにログを集計して興味分野をデータ活⽤用の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.
Redshiftのアーキテクチャ
•
MPP
(超並列列演算)
–
CPU、Disk・Network I/Oの並列列化
–
論論理理的なリソースの括り「ノードスライス」
•
データの格納
–
列列指向(カラムナ)
–
圧縮
•
データの通信
–
コンピュート・ノード間の通信
–
各コンピュート・ノードからリーダー・ノードへの通信
–
他のAWSサービスとの通信
Amazon Redshift概要
•
リーダーノードを経由して
クエリーを実⾏行行
•
インターフェイスは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
…
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)
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Redshiftの拡張性
28
XL 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L 8X L シングルノード XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL XL クラスター 2 – 32ノード クラスター 2 – 100ノードdw1.xlarge &
Amazon S3からCSVファイルをロードしてみる
•
まずは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’;!
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Redshiftにログインしてデータロードしてク
エリを掛けてみる
30
•
Redshiftのシェルでテーブルを定義
CREATE TABLE nginx (!
remote_addr char(15),!
time timestamp,!
request varchar(255),!
status integer,!
bytes bigint,!
ua varchar!
);!
あとはいつものSQL
SELECT ua, request, COUNT(*) !
FROM nginx!
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S3へデータを書き出すのも簡単
32
UNLOAD TO ‘s3://YOUR_BUCKET/PATH/!
SELECT * FROM nginx;!
Amazon Redshiftとは・・・
•
⼤大量量のデータを⾼高速に
SQL
で処理理してくれる
•
RDB
と違いデータ量量が増えても性能が劣劣化しにく
い
•
ただし
、
あくまで
OLAP
⽤用データベースである
•
データは
ETL
や正規化されている必要がある
•
集計や統計など
、
数値の可視化に有効
レポートツール等
,
データ可視化に最適
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Redshiftについてより深く知りたい⽅方は・・
•
Amazon Redshiftパフォーマンス・チューニン
グ
–
資料料: http://media.amazonwebservices.com/jp/
summit2014/TA-‐‑‒08.pdf
–
動画: https://www.youtube.com/watch?
v=_̲x4o1vNWbAA
©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として
利用できる
36
ワークフローマネージメント:スクリプトでHadoopを起動
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.
38
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を起動
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.
40
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を起動
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.
42
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を起動
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.
仕事を予め定義して起動し
、
終わったら⾃自動削除
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] \!
©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のデータを扱える
•
HDFSとシームレスにS3上のデータを扱える
•
INPUTやOUTPUTにs3://〜~を指定する
48
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に吐き出す
もちろん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!
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hiveを使ったETL
INSERT INTO TABLE table2!
SELECT!
column1,!
column2,!
column5,!
FROM table1;!
!
50
←例例えばtable1から
column3,4を除外したい
同じようにDynamoDBのテーブルもマウントできるの
で・・・
CREATE EXTERNAL TABLE dynamodb_as_external_table(!
"user_id INT,!
"movie_id INT,!
"rating INT,!
"unixtime STRING )!
STORED BY 'org.apache.hadoop.hive.dynamodb.DynamoDBStorageHandler' !
TBLPROPERTIES (!
"dynamodb.table.name" = ”your_table",!
"dynamodb.column.mapping" = !
”user_id:UserID,movie_id:MovieId,rating:Rating,unixtime:UnixTime”!
);!
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
INSERT OVERWRITE TABLE!
"s3_as_external_table!
SELECT * !
FROM dynamodb_as_external_table;!
52
同じようにDynamoDBのテーブルもマウントできるの
で・・・
•
DynamoDBのデータをS3にバックアップしたり
SELECT COUNT(*) !
FROM dynamodb_as_external_table;!
•
DynamoDBのデータをHiveでMapReduceしたりできる
EMR
ちょっと
Deep Dive
©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
•
map reduce, hive, pig, streamingなどのHadoopの
エコシステムが利利⽤用できる
•
hiveでSQLっぽく使うこともできるがRedshiftのほう
が速いし簡単(ただし、TRANSFORMやUDF/UDAFな
どの独⾃自のメリットはある)
•
正規化しづらいデータを扱うのが得意
•
⽴立立ちあげっぱなしではなく、ジョブごとにクラスタを
起動して終了了した破棄する使い⽅方もできる
EMRかRedshiftか
•
SQL
を使った分析
/
解析なら
Redshift
のほ
うが圧倒的に速い
•
それ以外なら
EMR
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Elastic MapReduceとは・・・
•
Hadoop
を便便利利に利利⽤用できるようにしたサービスで
⼤大量量のテキストデータを整形するのが⾮非常に得意
•
ワークフローをうまく活⽤用すれば処理理の⾃自動が⽤用意
•
S3
のデータを⾃自在に扱える
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DynamoDBとは
•
NoSQL as a Service
•
データ量量が増えても性能が劣劣化しない
DynamoDBの特⻑⾧長
•
管理理不不要で信頼性が⾼高い
•
プロビジョンドスループット
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
特⻑⾧長1:管理理不不要で信頼性が⾼高い
•
SPOFの存在しない構成
•
データは3箇所のAZに保存されるので信頼性が⾼高い
•
ストレージは必要に応じて⾃自動的にパーティショニング
される
クライアント
特⻑⾧長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:ストレージの容量量制限がない
•
使った分だけの従量量課⾦金金制のストレージ
•
データ容量量の増加に応じたディスクやノードの増設作業
DynamoDBの構成要素
API
SDK
•
オペレーションはHTTPベースのAPIで提供されている
•
ユーザーはコードを書くだけで利利⽤用できる
Database
Cl
ient
S
ide
Ser
vice Sid
e
Client application
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DynamoDBのテーブルのプライマリキーの持ち⽅方は2種類
•
Hash key
プライマリキーがハッシュキーのサンプル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を払い出す機能はないので注意
。
プライマリキーがハッシュ&レンジのテーブルサンプル:
ゲームの⾏行行動履履歴管理理データベース
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ゲームの⾏行行動履履歴管理理データベース
User (Hash) Timestamp (Range) Opponent ResultAlice 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 HistoryDan 02-24 09:48 Won! Alice 02-21 12:42 Won!
テーブル設計のための基礎知識識+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
ができるわけではない
•
⼤大量量のデータを格納しておいて
、
必要な少数のデー
タを⾼高速にやりとりするのに強みを持つ
EMR
EMR
Redshift
DynamoDB
Data Pipeline
S3
Data
ETL
Sum
Web app
Analytics
Dashboard
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
AWS上でデータ処理理を⾏行行う際には
S3の利利⽤用がキー
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Elastic
MapReduce
DynamoDB
Redshift
S3
データがS3にあれば
あとは必要に応じて処理理クラスタを起動して利利⽤用できる
S3とEMR
Hadoop単体ではデータ共有はできない
↓
ひとつのデータに対する処理理は
ひとつのクラスタに強く結合してしまう
↓
キャパシティプランニングが難しい
時間
負荷
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S3とEMR
S3
時間
負荷
キャパシティ
データをHDFSではなく
S3に格納しておけば・・
78
S3とEMR
S3
S3上のデータを複数の
クラスタから共⽤用できる
↓
仕事量量に合わせて都度度
クラスタを⽴立立ち上げて使える!
時間
負荷
キャパシティ
©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 ‘,’
Redshift
S3
S3とRedshift
RedshiftからS3への
エクスポートも容易易
Redshift
S3
UNLOAD (‘SELECT * FROM…’)
TO ‘s3://fuga/….’
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S3とRedshift
古いデータはより安価な
ストレージのGlacierへ
Redshift
S3
Glacier
82
S3とRedshift
クラスタに問題が起こったら
、
S3からクラスタを再構築
Redshift
S3
Glacier
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S3とDynamoDB
DynamoDB
S3とDynamoDB
古いデータはS3へオフロード
もしくはバックアップ
DynamoDB
S3
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S3とDynamoDB
DynamoDB
S3
Glacier
更更に古いデータはGlacierへ
86
S3を使ったパイプライン処理理
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S3を使ったパイプライン処理理
S3
S3
EMR
処理理1
88
S3を使ったパイプライン処理理
S3
S3
S3
EMR
EMR
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S3を使ったパイプライン処理理
S3をチェックポイントとして利利⽤用することによって
処理理を疎結合にできる
S3
S3
S3
EMR
EMR
処理理1
処理理2
90
S3を使ったパイプライン処理理
S3
S3
S3
EMR
EMR
処理理1
処理理2
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S3を使ったパイプライン処理理
チェックポイントからやりなおせる
S3
S3
EMR
EMR
処理理1
処理理2
S3
92
Amazon S3 データ 分析 Elastic MapReduce Redshift データ バックアップ EC 2 RDS Storage Gatewa y EBS コンテンツ 配信 CloudFront データ アクセスGW Storage Gateway コンテンツ トランスコード Elastic Transcode r コンテンツ アーカイブ データ 交換 Data Pipeline
⼤大事なことなのでもう⼀一度度
。
中⼼心にあるのはいつもS3
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EMR
ETL済みデータRedshift
S3
ログ(オリジナル)S3
処理理済みデータWebサーバー
ログ集約サーバー
リアルタイム性の導⼊入
96
BIツールなど
データ提供API
DynamoDB
ETL済みデータEMR
処理理済みデータS3
15分や1時間に1回データを更更新する
15分や1時間に1回データを更更新する
データは逐次的に流流れる
EMR
ETL済みデータRedshift
S3
ログ(オリジナル)S3
処理理済みデータWebサーバー
リアルタイム性の導⼊入
BIツールなど
データ提供API
DynamoDB
ETL済みデータEMR
処理理済みデータS3
15分や1時間に1回データを更更新する
15分や1時間に1回データを更更新する
データは逐次的に流流れる
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EMR
ETL済みデータRedshift
S3
ログ(オリジナル)S3
処理理済みデータWebサーバー
リアルタイム性の導⼊入:ラムダアーキテクチャ
98
BIツールなど
データ提供API
DynamoDB
ETL済みデータEMR
処理理済みデータS3
15分や1時間に1回データを更更新する
15分や1時間に1回データを更更新する
データは逐次的に流流れる
リアルタイムに速報値を流流し込む
リアルタイムに速報値を流流し込む
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.