Mais conteúdo relacionado
Semelhante a ビッグデータサービス群のおさらい & AWS Data Pipeline (20)
Mais de Amazon Web Services Japan (20)
ビッグデータサービス群のおさらい & AWS Data Pipeline
- 1. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
AWSマイスターシリーズ
ビッグデータサービス群のおさらい
+
AWS Data Pipeline
2014.3.19
ソリューションアーキテクト
今井 雄太 蒋 逸峰
re:Generate
- 2. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
アジェンダ
! AWSのビッグデータエコシステムのおさらい
! AWS Data Pipelineの紹介
! まとめ
- 3. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
AWSビッグデータサービス群のおさらい
- 4. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Storage
Data WarehouseNoSQL
DynamoDB Redshift
S3
Glacier
Data Pipeline
Relational Database
Hadoop
Workflow
Management
RDS
EMR
Data
Kinesis
Stream
Computing
Cold Storage
AWSのビッグデータサービス群
- 5. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
AWSビッグデータサービス群
Amazon Simple Storage Service(S3)
Amazon Glacier(Glacier)
• 容量量制限がなく、利利⽤用分だけの⽀支払い
で利利⽤用できるストレージ
• データの耐久性は99.999999999%
• 静的HTTPサーバーとしても利利⽤用可
• S3と同等のデータ耐久性
• S3の約8分の1の価格で利利⽤用可能なスト
レージ
• データの取り出しリクエストからアクセ
ス可能になるまで約4時間かかる
- 6. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
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か
らエンジンを選択可能
- 7. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
AWSビッグデータサービス群
Amazon Elastic MapReduce(EMR)
Amazon Kinesis(Kinesis)
• マネージドHadoop
• HDFSとシームレスにS3を扱える
• Stream Computingのためのサービス
• ストリーミングMapReduceのようなこと
を容易易に可能にしてくれる
- 8. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
AWSビッグデータサービス群
AWS Data Pipeline(Data Pipeline)
• データの移動やETLのバッチ処理理/
パイプライン処理理のためのオーケ
ストレーションサービス
- 9. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Amazon S3
データ
分析
Elastic
MapReduce
Redshift
データ
バックアップ
EC2 RDS
Storage
Gateway
EBS
Redshift
コンテンツ
配信
CloudFront
データ
アクセスGW
Storage
Gateway
コンテンツ
トランスコード
Elastic
Transcoder
コンテンツ
アーカイブ
Glacier
データ
交換
Data Pipeline
中⼼心にあるのはいつもS3
- 10. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
EMR DynamoDB Redshift
S3
データがS3にあれば
あとは必要に応じて解析クラスタを起動して利利⽤用できる
解析もオリジンデータはS3に
- 11. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3とEMR
Hadoop単体ではデータ共有はできない
↓
ひとつのデータに対する処理理は
ひとつのクラスタに強く結合してしまう
↓
キャパシティプランニングが難しい
時間
負荷
キャパシティ
- 12. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3とEMR
S3
データをHDFSではなく
S3に格納しておけば・・
時間
負荷
キャパシティ
- 13. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3とEMR
S3
S3上のデータを複数の
クラスタから共⽤用できる
↓
仕事量量に合わせて都度度
クラスタを⽴立立ち上げて使える!
時間
負荷
キャパシティ
- 14. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3とRedshift
RedshiftS3
データ
Redshiftへのデータロードは
S3経由が効率率率的
COPY table_name FROM ‘s3://hoge’
CREDENTIALS ‘access_key_id:hoge…’
DELIMITER ‘,’
- 15. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3とRedshift
RedshiftS3
Glacier
RedshiftからS3への
エクスポートも容易易
UNLOAD (‘SELECT * FROM…’)
TO ‘s3://fuga/….’
CREDENTIALS ‘access_key_id:hoge…’;
- 16. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3とRedshift
RedshiftS3
Glacier
古いデータはより安価な
ストレージのGlacierへ
- 17. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3とRedshift
RedshiftS3
Glacier
クラスタに問題が起こったら、
S3からクラスタを再構築
- 18. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3とDynamoDB
DynamoDB
- 19. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3とDynamoDB
DynamoDBS3
古いデータはS3へオフロード
もしくはバックアップ
- 20. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3とDynamoDB
DynamoDBS3Glacier
更更に古いデータはGlacierへ
- 21. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3を使ったパイプライン処理
S3
- 22. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3を使ったパイプライン処理
S3 S3
EMR
処理理1
- 23. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3を使ったパイプライン処理
S3 S3 S3
EMR EMR
処理理1 処理理2
- 24. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3を使ったパイプライン処理
S3 S3 S3
EMR EMR
処理理1 処理理2
S3をチェックポイントとして利利⽤用することによって
処理理を疎結合にできる
- 25. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3を使ったパイプライン処理
S3 S3 S3
EMR EMR
処理理1 処理理2
処理理が途中で失敗したら・・・
- 26. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
S3
EMR
処理理1
S3を使ったパイプライン処理
S3
EMR
処理理2
チェックポイントからやりなおせる
S3
- 27. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Amazon S3
データ
分析
Elastic
MapReduce
Redshift
データ
バックアップ
EC2 RDS
Storage
Gateway
EBS
Redshift
コンテンツ
配信
CloudFront
データ
アクセスGW
Storage
Gateway
コンテンツ
トランスコード
Elastic
Transcoder
コンテンツ
アーカイブ
Glacier
データ
交換
Data Pipeline
⼤大事なことなのでもう⼀一度度。
中⼼心にあるのはいつもS3
- 28. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Glacier
ログ(長期保存)
EMR
Redshift
ETL済みデータS3
ログ(オリジナル)
RDS
集計済みデータ
S3
処理済みデータ
Webサーバー
ログ集約サーバー ETLもしくは集計
1.1.1.1, /login, 20140226000101, …
1.1.1.1, /home, 20140226011226, …
1.1.1.2, /home, 20140226011331, …
DATE PATH UU
------------------------
2014-02-26 /login 1
2014-02-26 /home 2
ユースケース1:アクセスログレポート
USER PATH TIMESTAMP
-----------------------------------
USER1 /login 2014-02-26 00:00:01
USER1 /home 2014-02-26 01:12:26
USER2 /home 2014-02-26 01:13:31
- 29. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
ユースケース2:ストリーム処理理
DynamoDBKinesis
データ収集サーバー
Kinesisアプリケーション
Twitter
ストリームAPI
HASH_TAG TIME COUNT
------------------------
A 2014-02-26 00:00 30
A 2014-02-26 00:01 20
B 2014-02-26 00:00 10
B 2014-02-26 00:01 5
- 30. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
中まとめ
- 31. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Glacier
RDS
EMR
RedShift
DynamoDB
S3
Data
WebApp
BI
Dashboard
Data Pipeline
中まとめ:AWSビッグデータサービス群の俯瞰図
Kinesis
- 32. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Glacier
RDS
EMR
RedShift
DynamoDB
S3
Data
WebApp
BI
Dashboard
Kinesis
Data Pipeline
AWS Data Pipelineの紹介
- 33. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
なぜData Pipeline?
データのマイグレーションが簡単じゃない
• 異異なる場所、異異なるフォーマット
• S3, RDS, EMR, Redshift, DynamoDB
• オンプレミス
依存管理理が複雑
• ⼊入⼒力力データが存在
• 前の処理理が成功
異異常処理理が必要
• 失敗時のリトライ
• タイムアウト
• イベント通知
Input Data
Ready?
Run…
Yes
No
- 34. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
AWS Data Pipelineとは
特定の間隔でコンピュートとストレージのサービス間
のデータ統合・処理理を⾃自動的に⾏行行うサービス
• AWSサービス間データ連携が簡単に
• オンプレミスとAWSの間も可能
• ⾼高い信頼性を保つための仕組み
- 35. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Pipelineの定義
データ処理理を定義するための情報
• Data Node: データの場所、フォーマット
• Activity: データ処理理のアクティビティ
• Schedule: 処理理実⾏行行のスケジュール
• Resource: 処理理や条件チェックを⾏行行うリソース
• Precondition: 処理理実⾏行行の条件
• Action: 通知を送る⽅方法
- 36. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
アクティビティ(Activities)
データ移動や処理理の全体を管理理
• ⼊入出⼒力力、スケジュール、処理理内容、リソース、通知アクション
• AWSとオンプレミスにて実⾏行行可能
サポートするアクティビティ⼀一覧
• CopyActivity
• EmrActivity
• HiveActivity
• HiveCopyActivity
• PigActivity
• RedshiftCopyActivity
• SqlActivity
• ShellCommandActivity
- 37. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
データノード
Input / Outputデータの場所やタイプを定義
• S3パス
• SQL データベース
• DynamoDB
• Redshift
フォーマット指定は⾃自由
• CSV Data Format
• カスタマイズ
- 38. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
データとテーブルのステージング
データにアクセスしやすいための仕組み
• データを⾃自動的にリソースにコピー / テーブルを⾃自動的に作成
• データがリソースのローカルにあるように
• サポートデータノード: S3DataNode, SqlDataNode
• サポートアクティビティ
• ShellCommandActivity
• 初期値: off. Stage = true にセット
• 変数: ${INPUTx_̲STAGING_̲DIR} , ${OUTPUTx_̲STAGING_̲DIR}
• HiveActivity
• 初期値: on.
• 変数: ${inputx}, ${outputx}
{
"id": "MyHiveActivity",
…
"hiveScript": "INSERT OVERWRITE TABLE ${output1} select * from ${input1};"
},
Table作成は
不要
- 39. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
依存関係(Preconditions)
条件が成⽴立立した場合のみ後継タスクを実⾏行行
• DynamoDB tableが存在/データがある
• S3キーが存在
• S3プリフィックスが存在
• 独⾃自のShellコマンド実⾏行行が成功
• 依存するpipelineタスクが成功
S3 key
exists?
Copy…
Yes
No
- 40. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
スケジュール
処理理を実⾏行行するタイミング
• Cronスタイル: 指定した間隔のstart時点で起動
• Time Seriesスタイル: 指定した間隔のend時点で起動
• ただし、EC2やEMRリソースは常にstart時点に作成
• 間隔: 15分、時、⽇日、週など
• 15min ~∼ 3year
Start/
Cron1
TS1 /
Cron2
Period
時間
TS2 /
Cron3
Period
- 41. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
スケジュール(2)
Backfillタスク
• 開始時間に過去を指定した場合、現在まで遡ってタスクを繰り返
し実⾏行行
• テストに便便利利
• 開始時間が1⽇日以前の場合、タスク起動しない
• CLIで --force 引数を指定して起動可能
タイムゾン
• 初期値: UTC, “YYYY-‐‑‒MM-‐‑‒DDTHH:MM:SS” フォーマット
• 変数にタイムゾン指定可能
• #{inTimeZone(myDateTime,ʼ’Asia/Tokyo')}
- 42. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
リソース
タスクを実⾏行行するリソース
• EC2: EC2-‐‑‒ClassicとEC2-‐‑‒VPC両⽅方サポート
• EMR: タスクノードにspot instance利利⽤用可能
• Multi-‐‑‒regionのリソース管理理が可能
- 43. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
リソース(2)
アクティビティとリソースのスケジュールを別々に指定
可能
• リソースを最⼤大限に利利⽤用
• Activityスケジュール: 20分
• Resourceスケジュール: 1時間
• 結果: EMRが1クラスタのみ課⾦金金
Task 1 Task 2 Task 3
時間
節約分
- 44. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
イベントと異常管理
イベントが発⽣生するタイミング
• 成功時
• 失敗時
• 遅れが発⽣生した場合
設定可能なアクション
• SNS通知
• リソースを削除
失敗時⾃自動リトライ
• 初回実⾏行行含め、1~∼6回の実⾏行行回数を設定可能
• 初期値は3回
Task 1
失敗成功
Task 2
Alert
Alert成功
失敗
- 45. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
簡単に利用スタート
• よくあるユースケースはテンプレートが⽤用意
• 管理理画⾯面からGUI操作
• CSV/TSVのネイティブサポート
• ⾃自動的にEMR/EC2をセットアップ
- 46. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
ファイル出力
GUIの操作結果をJSONに出⼒力力可能
• Pipelineのバージョン管理理
• 出⼒力力したファイルは
CLIでインポート可能
./datapipeline --create pipeline_name --put pipeline_file
--activate --force
{
"objects": [
{
"id": "ActivityId_YYbJV",
"schedule": {
"ref": "ScheduleId_X8kbH"
},
"scriptUri": "s3://mybucket/
myscript.sh",
"name": "ShellActivity1",
"runsOn": {
"ref": "ResourceId_5nJIh"
},
...
]
}
• インポート前にバリデーションで
きる
./datapipeline –validate my-pipeline.json –credential
credetials.json --force --id df-0123456789ABCD
- 47. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
料金
• 無料料使⽤用枠あり
• アクティビティ、または依存関係の従量量課⾦金金
• 実際に利利⽤用したリソース(EC2, S3など)の課⾦金金
高頻度 (>1日1回) 低頻度
On AWS $1.00 $0.60
オンプレミス $2.50 $1.50
実行しないpipeline $1.00
* 2014/3/19時点、東京リージョンのアクティビティ / 依存関係の⽉月額単価
- 48. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
DynamoDB Import/Export
DynamoDB Import/ExportはData Pipelineを利利⽤用
- 49. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Ad インプレッション集計の例
• S3にあるログとRDSのマスタ
データを結合
• EMR Hiveで整形
• 結果をS3に出⼒力力
• Redshiftにロード
• SQLで集計しBIテーブルに
ロード
• スケジュールで起動(例例:1
回/時)
• S3ログが存在の場合のみHive
起動
• 失敗時SNSで通知
• リトライ設定
- 50. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
まとめ
- 51. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
AWS上のビッグデータ活用
• AWSには多様なビッグデータ関連サービスがある
• ユースケース別によくある構成やベストプラクティス
が存在する
• Data Pipelineは⾼高い拡張性のある⼿手法で クラウドや
オンプレミスに蓄積されたデータを変換・処理理するこ
とできる
• AWSのビッグデータサービスをうまく活⽤用してビッグ
データの活⽤用を加速させよう
- 52. © 2012 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
ご参加ありがとう
ございました