SlideShare a Scribd company logo
1 of 84
Download to read offline
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アマゾン ウェブ サービス ジャパン株式会社
ソリューションアーキテクト 桑野 章弘
2019.06.25
【AWS Black Belt Online Seminar】
Amazon DocumentDB
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
自己紹介
桑野 章弘(くわの あきひろ)
ソリューションアーキテクト
主にメディア系のお客様を担当しております
元渋谷のインフラエンジニア
好きなAWSのサービス:DocumentDB、Aurora、Route53、S3
好きな(?)データストア:MongoDB
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Black Belt Online Seminar とは
「サービス別」「ソリューション別」「業種別」のそれぞれのテーマに分かれて、アマゾ
ン ウェブ サービス ジャパン株式会社が主催するオンラインセミナーシリーズです。
質問を投げることができます!
• 書き込んだ質問は、主催者にしか見えません
• 今後のロードマップに関するご質問は
お答えできませんのでご了承下さい
① 吹き出しをクリック
② 質問を入力
③ Sendをクリック
Twitter ハッシュタグは以下をご利用ください
#awsblackbelt
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
内容についての注意点
• 本資料では2019年6月25日時点のサービス内容および価格についてご説明しています。最新の情報
はAWS公式ウェブサイト(http://aws.amazon.com)にてご確認ください。
• 資料作成には十分注意しておりますが、資料内の価格とAWS公式ウェブサイト記載の価格に相違が
あった場合、AWS公式ウェブサイトの価格を優先とさせていただきます。
• 価格は税抜表記となっています。日本居住者のお客様が東京リージョンを使用する場合、別途消費
税をご請求させていただきます。
• AWS does not offer binding price quotes. AWS pricing is publicly available and is subject
to change in accordance with the AWS Customer Agreement available at
http://aws.amazon.com/agreement/. Any pricing information included in this document
is provided only as an estimate of usage charges for AWS services based on certain
information that you have provided. Monthly charges will be based on your actual use
of AWS services, and may vary from the estimates provided.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
ドキュメント指向DBとは
Amazon DocumentDBの概要
Amazon DocumentDBのアーキテクチャ
Amazon DocumentDBの使い方
ベストプラクティス
他サービスとの使い分け
移行方法
料金体系
まとめ
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
ドキュメント指向DBとは
Amazon DocumentDBの概要
Amazon DocumentDBのアーキテクチャ
Amazon DocumentDBの使い方
Amazon DocumentDBのサービス概要
他サービスとの使い分け
移行方法
料金体系
まとめ
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
クライアント
アプリケー
ション
データベース
JSON
!=
今までのデータベースのデータ連携の一例
Relational
JSONはデータ
連携のデファク
トに
アプリケー
ションはデー
タベースから
返ってくる
データと
JSONの整合
性を取る
整合性のためにオ
ブジェクトリレー
ショナルマッパー
(ORM)が必要
対応コスト増
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
クライアント
アプリケー
ション
データベース
JSON
≒
ドキュメント指向データベースのデータ連携
JSON-Like
JSONはデータ
連携のデファク
トに
アプリケー
ションはド
キュメント
データベース
のJSONの整
合性を取るの
は最小限です
む
ORMを使う必要
も限定的となる
対応コスト低:ド
キュメントデータ
ベースはこの問題
への一つの解とな
りうる
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ドキュメント指向データベース
• JSON-likeなデータ
• ドキュメントはより自然な
形でデータを表現可能
• 柔軟性のあるスキーマ、イ
ンデックス
• Javascriptで表現可能な柔
軟なクエリ
{
id: 1,
name: ”kuwano",
age: 41,
email: ”kuwanoa@amazon.com",
promotions: ["new user", "5%", ”curry lover"],
memberDate: 2015-9-27,
shoppingCart: [
{product:"abc", quantity:2, cost:19.99},
{product:"edf", quantity:3, cost: 2.99}
]
}
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ドキュメントデータベースのユースケース
モバイル
アプリ
リテール
&
マーケ
ティング
ユーザ
プロファイル
カタログ
コンテンツ管理 パーソナライ
ゼーション
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ドキュメントデータベースのユースケース
ゲームのユーザプロフィール
{
id: 181276,
username: "sue1942",
name: {first: "Susan",
last: "Benoit"}
}
{
id: 181276,
username: "sue1942",
name: {first: "Susan",
last: "Benoit"},
ExplodingAcorns: {
hi_score: 3185400,
global_rank: 5139,
bonus_levels: true
},
promotions: ["new user","5%",”acorn lover"]
}
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ドキュメントデータベースのユースケース
ゲームのユーザプロフィール
{
id: 181276,
username: "sue1942",
name: {first: "Susan",
last: "Benoit"}
}
{
id: 181276,
username: "sue1942",
name: {first: "Susan",
last: "Benoit"},
ExplodingAcorns: {
hi_score: 3185400,
global_rank: 5139,
bonus_levels: true
},
promotions: ["new user","5%",”acorn lover"]
}
トロフィーを追加
スコアやランクを追加
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ドキュメントデータベースのユースケース
ゲームのユーザプロフィール
{
id: 181276,
username: "sue1942",
name: {first: "Susan",
last: "Benoit"},
ExplodingAcorns: {
hi_score: 3185400,
global_rank: 5139,
bonus_levels: true
},
promotions: ["new user","5%",”acorn lover"]
}
{
id: 181277,
username: ”akuwano",
name: {first: ”Akihiro",
last: ”Kuwano"},
nickname: ”mongo",
ExplodingAcorns: {
hi_score: 100,
global_rank: 100000,
bonus_levels: true
},
promotions: ["new user","5%",”curry lover"]
}
ニックネームを追加
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ドキュメントデータベースで開発を高速に
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
ドキュメント指向DBとは
Amazon DocumentDBの概要
Amazon DocumentDBのアーキテクチャ
Amazon DocumentDBの使い方
Amazon DocumentDBのサービス概要
他サービスとの使い分け
移行方法
料金体系
まとめ
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWSのデータベース
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Purpose built
The right tool for the right job
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWSのデータベース
Relational
参照整合性、
ACIDトラン
ザクション、
スキーマ
Lift and shift, ERP,
CRM, finance
Key-value
高スループット、
低レイテンシ、
スケーラ
ビリティ
Real-time bidding,
shopping cart, social,
product catalog,
customer preferences
Document
ドキュメント
を保存し、任
意の属性にク
エリですばや
く
アクセス
Content
management,
personalization,
mobile
In-memory
マイクロ秒
レベルの
keyアクセス
Leaderboards,
real-time analytics,
caching
Graph
すばやく簡単
にデータ間の
関係を元に
グラフ構造を
作成、
ナビゲート
Fraud detection,
social networking,
recommendation
engine
Time-series
時系列に特化
した形で
データの収集、
格納、処理
IoT applications,
event tracking
Ledger
アプリケーション
データの全変更を
完全、不変、
検証可能な
履歴として保存
Systems
of record, supply
chain, health care,
registrations,
financial
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWSのデータベース
Relational Key-value Document In-memory Graph Time-series Ledger
Aurora CommercialCommunity
Amazon
DocumentDB
Amazon
DynamoDB
Amazon
ElastiCache
Amazon
Neptune
Amazon
Quantum
Ledger
Database (QLDB)
Amazon
RDS
Amazon
Timestream
New!
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB
(with MongoDB Compatibility)
Fast, scalable, and fully managed MongoDB-compatible database service
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
既存のドキュメント指向データベースの課題
管理 スケールセットアップ セキュリティ バックアップ
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Fast Efficient Optimized Flexible
秒間100万リクエス
トが実行可能
効率よくリソースを
実行可能
数分でスケールアウ
ト&スケールアップ
可能
ストレージレイヤ
でI/Oを最適化
Fast, scalable, fully managed MongoDB-compatible database service
Amazon DocumentDB
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Scale out
in minutes
Scale up
in minutes
Autoscaling
storage
Load balancing
15台のリードレプリ
カが追加可能
15-768 GiBのメ
モリ容量までス
ケールアップ
ストレージの自動
拡張 10GB から
64 TB まで
リードレプリカでの
負荷分散
Fast, scalable, fully managed MongoDB-compatible database service
Amazon DocumentDB
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Pay-as-you-
go pricing
Automated
Backup and
PITR
Fault tolerant and
self-healing
storage
S3へのストリー
ムバックアップ
3AZ、6 コピー
によるデータ
冗長
リードレプリカの
昇格による自動
フェイルオーバ
Automatic
failover and
recovery
必要な分、使った
分だけの課金体系
Fast, scalable, fully managed MongoDB-compatible database service
Amazon DocumentDB
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Fast, scalable, fully managed MongoDB-compatible database service
Amazon DocumentDB
MongoDB 3.6
API
Same drivers,
tools
Migrate with
DMS
Replica set
emulation
MongoDB
Community Edition
3.6 との互換性
MongoDB driver
や ツール が
Amazon
DocumentDB で使
用可能
AWS DMS を
使ったライブマイ
グレーション
(無料枠あり)
レプリカセットエ
ミュレーションに
よる読み取りス
ケール
https://aws.amazon.com/jp/dms/free-dms/
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon VPC Default
Encryption
Safe
defaults
Compliant
VPC のみ TLS、
Encryption at
rest
(カスタママ
ネージドキー使
用)
最適化された
設定値
PCI, ISO, SOC2,
HIPAA
Security and Compliance
Amazon DocumentDB
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Backup and Point-In-Time Recovery
Amazon DocumentDB
Automatic backups 35 days of
PITR
Archive
snapshots
自動インクリメンタ
ルかつ継続的なスト
リーミングバック
アップ
データベースへ
性能影響のない
バックアップ
最大35日の
Point-in-time
recovery (PITR)
35日以上の場合はス
ナップショットも
可能
No performance
impact
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB の特徴
• マネージドドキュメントデータベースサービス
• JSON-likeなデータ群をマネージドする用途に特化したデータスト
ア
• MongoDBとの互換性
• MongoDB 3.6 系互換API対応
• 高可用性
• ミッションクリティカルワークロードを大規模に運用する場合に効果的
• 高パフォーマンス
• ストレージとコンピュートを分離し高いパフォーマンスを実現
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
ドキュメント指向DBとは
Amazon DocumentDBの概要
Amazon DocumentDBのアーキテクチャ
Amazon DocumentDBの使い方
Amazon DocumentDBのサービス概要
他サービスとの使い分け
移行方法
料金体系
まとめ
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB アーキテクチャ
• 3つのチャレンジ
• コンピュートとスト
レージの分離
• パーティションへの
データ分散
• 6コピーとクオラムによ
るデータの堅牢性
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
コンピュートとストレージの分離
• コンピュートとストレージを分離することで個別に最適
なスケールを行うことができる
コンピュートのスケール
ストレージのスケール
コンピュート
レイヤ
ストレージレ
イヤ
API
Query Processor
Caching
Logging + Storage
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
パーティションへのデータ分散
Distributed storage volume
パーティションへのデータ分散
AZ1 AZ2 AZ3
Logging + Storage
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Logging + Storage
Distributed storage volume
AZ1 AZ2 AZ3
データを3つのAZに6コピーする
6コピーとクオラムによるデータの堅牢性
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Distributed storage volume
AZ1 AZ2 AZ3
AWS Region
Availability Zone 1 Availability Zone 2 Availability Zone 3
Reads
Reads
Reads
Write
s
Instance
(primary)
Instance
(replica)
Instance
(replica)
Amazon DocumentDB: オーバービュー
クラスタエンドポイント リーダーエンドポイント
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Distributed storage volume
AZ1 AZ2 AZ3
AWS Region
Availability Zone 1 Availability Zone 2 Availability Zone 3
Reads
Reads
Reads
Write
s
Instance
(primary)
Instance
(replica)
Instance
(replica)
Amazon DocumentDB: エンドポイント
クラスタエンドポイント リーダーエンドポイント
書き込みノードを示すクラスタ
エンドポイントとリードレプリ
カを示すリーダーエンドポイン
トが存在
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB: スケーリング
Distributed storage volume
AZ1 AZ2
読み込みキャパシティのスケールをしたい場合
AZ3
最大15台のリードレプリカ, 100万リード/sec
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB: 障害復旧
インスタンス障害からの復旧
Distributed storage volume
AZ1 AZ2 AZ3
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB: 障害復旧
インスタンス障害からの復旧
Distributed storage volume
AZ1 AZ2 AZ3
インスタンス障害時は他のイン
スタンスへとフェイルオーバす
ることで障害復旧を行う
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB: 堅牢性
Distributed storage volume
AZ1 AZ2 AZ3
データの堅牢性を保つためにデータを6冗長でコピー
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB: 堅牢性
Distributed storage volume
AZ1 AZ2 AZ3
データの堅牢性を保つためにデータを6冗長でコピー
6つ中4つの書き込みクォーラム
6つ中3つの読み込みクォーラム
修復時には各ノード同士で
レプリケーションを実施
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Distributed storage volume
Availability Zone 1 Availability Zone 2 Availability Zone 3
Instance
(primary)
Instance
(replica)
Instance
(replica)
Amazon S3
Amazon DocumentDB: バックアップ
ストリーミングバックアップ
データベースへの性能影響のないストリーミングバックアップ
スナップショット
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
MongoDBの大規模構成例
mongod
• データノード
mongoc
• シャーディング情報を保存
する特殊なデータノード
mongos
• シャーディング時に適切な
シャードへと処理を振り分
けるルーティングプロセス
mongod
App +
mongos
mongoc
mongoc:シャ
ーディング情報
の格納
mongos:
シャードルーター
適切なシャードへの
割り振り
mongod:実際のデー
タの格納
赤の囲みが1シャー
ドとなり、シャード
単位で処理をオフ
ロードする
AZ AZ AZ各AZにノー
ド配置
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
MongoDBの大規模構成例
mongod
• データノード
mongoc
• シャーディング情報を保存
する特殊なデータノード
mongos
• シャーディング時に適切な
シャードへと処理を振り分
けるルーティングプロセス
mongod
App +
mongos
mongoc
mongoc:シャ
ーディング情報
の格納
mongos:
シャードルーター
適切なシャードへの
割り振り
mongod:実際のデー
タの格納
赤の囲みが1シャー
ドとなり、シャード
単位で処理をオフ
ロードする
AZ AZ AZ各AZにノー
ド配置
大規模なMongoDBはシャード
構成を組むことが多い
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Distributed storage volume
AZ1 AZ2 AZ3
AWS Region
Availability Zone 1 Availability Zone 2 Availability Zone 3
Reads
Reads
Reads
Write
s
Instance
(primary)
Instance
(replica)
Instance
(replica)
Amazon DocumentDB: アーキテクチャ再掲
クラスタエンドポイント リーダーエンドポイント
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
何故シャーディングが必要ない?
読み込みスケール
シャードしたい要因
書き込みスケール
ストレージスケール
15台までのリードレプリカ
インスタンスのスケールアップが容易
DocumentDBでの対応
64TBまでのストレージ自動拡張
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
ドキュメント指向DBとは
Amazon DocumentDBの概要
Amazon DocumentDBのアーキテクチャ
Amazon DocumentDBの使い方
Amazon DocumentDBのサービス概要
他サービスとの使い分け
移行方法
料金体系
まとめ
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
ドキュメント指向DBとは
Amazon DocumentDBの概要
Amazon DocumentDBのアーキテクチャ
Amazon DocumentDBの使い方
Amazon DocumentDBのサービス概要
他サービスとの使い分け
移行方法
料金体系
まとめ
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB
のサービス概要
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB クラスタ
• Amazon DocumentDB クラスタ
• マスタ (Writer)とリードレプリカ(Reader)をひとまとめにし
たもの
• Parameter GroupとMaintenance WindowもDBクラスタと各
ノードそれぞれに存在
• フェイルオーバが発生しても常にマスタを参照するクラ
スタエンドポイント
• リードレプリカ群を指し示すリーダーエンドポイント
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
リードレプリカ
可用性
• データベースノードの障害は自動的に
検知され、交換される
• データベース処理の障害は自動的に検
知され、リソースはリサイクルされる
• リードレプリカは必要に応じて自動的
にマスタに昇格する
• どのリードレプリカに対して優先的に
フェイルオーバーさせるかを指定でき
る
Primary
Node
Primary
Nodeマスタ
Primary
Node
Primary
Node
リード
レプリカ
Primary
Node
Primary
Node
リード
レプリカ
クラスタ/
インスタンス
モニタリング
パフォーマンス
• リードレプリカによってアプリケーション
の読み込みトラフィックをスケールアウト
させることができる
• 読み込みエンドポイントによってリードレ
プリカを跨がって負荷が分散される
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
クラウドネイティブストレージエンジンの概要
データは3つのアベイラビリティーゾーンに跨がった
6つのレプリカにコピーされる
継続的に堅牢な Amaon S3 へバックアップされる
継続的にノードやディスクが修復される
修復やホットスポットのリバランスのために
10GBのセグメントユニットで管理されている
読み書きにはレイテンシ耐性を持つクォーラムシステムを使
用している
クォーラムのメンバーシップが変更されたとしても書き込み
は阻害されない
ストレージは使用に応じて自動的に64TBまで拡張される
AZ 1 AZ 2 AZ 3
Amazon S3
ストレージ
ノード
ストレージ
ノード
ストレージ
ノード
ストレージ
ノード
ストレージ
ノード
ストレージ
ノード
ストレージ
モニタリング
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
クラウドネイティブストレージエンジンの耐障害性
・どこに障害が発生すると仮定するか?
セグメント障害(ディスク)
ノード障害(マシン)
AZ障害(ネットワークやデータセンター)
・想定される障害に対する最適化
6つ中4つの書き込みクォーラム
6つ中3つの読み込みクォーラム
修復時には各ノード同士で
レプリケーションを実施
AZ 1 AZ 2 AZ 3
キャッシュ
Amazon
DocumentDB
AZ 1 AZ 2 AZ 3
キャッシュ
Amazon
DocumentDB
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
S3への継続的バックアップ
• セグメント毎に定期的にS3へ並列でバックアップが取得されている
• バックアップはパフォーマンスや可用性にインパクトを与えることなく絶えず行われている
• リストア時には、セグメント毎に適切なスナップショットと必要なログレコードが抽出される
• スナップショットへのログレコードの適用は並列に非同期的に実行される
セグメントスナップショット ログレコード
リカバリポイント
セグメント 1
時間
セグメント 2
セグメント 3
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
MongoDBとの互換性
• MongoDB Ver.3.6 とのAPI互換性
• Aggregation Pipeline や、インデックス、演算子など
の現状の対応状況については下記ドキュメントを参照
https://docs.aws.amazon.com/ja_jp/documentdb/latest/developerguide/functional-differences.html
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
セキュリティ : データベース認証
• Salted Challenge Response Authentication
Mechanism (SCRAM) をサポート
• SCRAM はMongoDB 用のデフォルトの認証メカニズム
• SCRAM を利用してMongoDB SDK、mongo シェル、およ
び各種ツールを使用して Amazon DocumentDB クラス
ターに接続可能
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
セキュリティ : 暗号化
通信の暗号化
• TLS対応
• セキュリティグループによる
アクセス制御
• IAMポリシー
• VPCのサービス提供
• パブリックエンドポイントは現
状作れない
保存データの暗号化
• クライアントからは透過的
• AES-256を使用した暗号化
• KMSを使用
• カスタママネージドキーも使用可
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
セキュリティ : 監査ログ
• Amazon DocumentDB のAudit logをCloudWatch
Logs に直接転送可能
• データ定義言語 (DDL)、認証、認可、およびユーザー管理
イベントが保存される
• Filter Patternを設定しMetricsを作成することが可能な
ため、CloudWatchを利用したアラートの発報も可能
DDL
UME
Auth Create event string
Create event string
Create event string Amazon
CloudWatch Logs
Amazon
DocumentDB
https://docs.aws.amazon.com/ja_jp/documentdb/latest/developerguide/event-auditing.html
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
モニタリング
• CloudWatchメトリクスに各種情報からクエリチューニ
ングやスケールアウト、アップを判断
• 主要なメトリクス一覧
メトリクス(一部) 説明
CPUUtilization CPU 使用率
Freeable Memory インスタンスで使用可能な RAM の量
Swap Usage インスタンスによって使用されているスワップスペースの量
Read IOPS、Write IOPS 1秒あたりのディスク読み取りまたは書き込みオペレーションの平均数
Read Latency、Write
Latency
読み取りまたは書き込みオペレーションの平均時間
Read Throughput、Write
Throughput
1 秒あたりのディスク読み取りまたは書き込みデータの平均量
Disk Queue Depth
ディスクに対する読み取りまたは書き込み待機中の I/O オペレーション
の数
Network Receive
Throughput、Network
Transmit Throughput
1 秒あたりのインスタンスに対する送信または受信ネットワークトラ
フィックのレート (メガバイト単位)。
DB Connections DB インスタンスに接続されたクライアントセッションの数
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
使い分け
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon RDSとの使い分け
• Amazon RDSを優先的に検
討したほうがよい場合
• トランザクションを
使って信頼性の高いク
エリを投げたい
• 金融、認証などの事前
定義されたスキーマに
従って使用したい
• Oracle、MySQL、
PostgreSQLなどの
RDBMSのエコシステム
を使いたい場合
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DynamoDBとの使い分け
• よりスケーラブルに使いた
いのであればDynamoDB
を選択するほうが良い
• データの持ち方として
JSONのよりネストした構
造にたいして柔軟にアクセ
スさせたいという場合には
DocumentDBのほうが開
発工数を下げられる可能性
が高い
{
"_id" : "1234567889",
"userid" : "akuwano",
"hobby" : “MongoDB”,
"username" : "Akihiro Kuwano”,
“info” : {
“age” : 41,
”country” : “japan”,
”states” : “tokyo”,
}
}
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
移行方法
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
移行パターン
十分な停止時間を
取れる
ダンプツール
(シンプル)
Database
Migration Serviceと
ダンプのハイブリッド
(柔軟・複雑)
Database
Migration Service
(柔軟)
移行完了までを高速
にしたい
はい
いいえ
はい
いいえ
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ダンプツール
• 停止時間は長いが、一番シンプルな方法
• MongoDB標準ツールだけで可能
• mongodump, mongorestore
2. Mongodumpで
バックアップの取得
3. 必要ならイン
デックス作成
(optional)
4. Mongorestore で
バックアップをレストア
1. アプリケーショ
ンは旧DBへの書き
込みを停止
5. アプリケーション
の向き先を
DocumentDB
に変更
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DMSを活用
• アプリの停止時間は短く、手順もシンプルだがフルロー
ドが終わるまで時間がかかる
2. 必要ならイン
デックス作成
(optional)
1. アプリケーション
は旧DB読み書きを継
続
4. アプリケーション
の向き先を
DocumentDB
に変更
3. DMSでフルロード
からCDCを実行
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DMSとダンプのハイブリッド
• アプリの停止時間は短く、マイグレーション完了までも
高速だが手順が複雑となる
2. Mongodumpで
バックアップの取得
3. 必要ならイン
デックス作成
(optional)
1. アプリケーション
は旧DB読み書きを継
続
6. アプリケーション
の向き先を
DocumentDB
に変更
5. DMSでCDCを実行
4. Mongorestore で
バックアップをレストア
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DocumentDB Index Tool
ソースのMongoDBからイン
デックス情報をExportする事
が可能
• DocumentDBとの互換性
についてインデックス、コ
レクション、データベース
などのチェック
• サポートされていないイン
デックスタイプのインデッ
クス、コレクションの
チェック
• などなどを実施
https://github.com/awslabs/amazon-documentdb-tools
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
料金体系
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Instance
(primary)
Instance
(replica)
Instance
(replica)
Amazon S3
Amazon DocumentDB の料金体系
Instances: Size/hr * count (db.r5.large $0.334/hr)
Backup: GB/mo
(ストレージクラスタの容量と同量まで無料
$0.023/GB)
Storage: GB/mo ($0.12/GB)
I/O: Count ($0.24/million)
東京リージョンの場合
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon DocumentDB の料金体系
①インスタンス料金
• r5.large( $0.334/h )から r5.24xl( $16.032/h )まで
②I/O回数
• $0.24 / 100万req
③ストレージ料金
• $0.12 / GB-month
④バックアップストレージ
• バックアップストレージ $0.023 / GB-month
東京リージョンの場合
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
月額料金計算例
https://aws.amazon.com/jp/documentdb/pricing/
db.r5.large/容量50GB(バックアップ50GB)
/平均77.2 iops (月間2億I/Oリクエスト)/リージョン外への通信量 10GB
要素 詳細
時間単位のオンデマンドインスタンス
料金
$240.48 ($0.334 * 24 * 30)
データベースストレージおよびI/O 容量 $6 ($0.12 * 50)
I/Oリクエスト $60 ($0.24 * 200)
バックアップストレージ $0
※データベースストレージ容量まで無料
データ転送 $1.026 ($0.114 * 9)
※1GBまでは無料
合計 $307.506
東京リージョンの場合
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
対応リージョン
• 東京
• バージニア
• オハイオ
• オレゴン
• アイルランド
• ソウル
• フランクフルト
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
ドキュメント指向DBとは
Amazon DocumentDBの概要
Amazon DocumentDBのアーキテクチャ
Amazon DocumentDBの使い方
Amazon DocumentDBのサービス概要
他サービスとの使い分け
移行方法
まとめ
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
まとめ
• マネージドドキュメントデータベースとして Amazon
DocumentDB がリリース
• ドキュメント指向データベースの選択肢が増えたことで
AWSのデータベースソリューリョンとしてより多様な
ユースケースに対応可能
• クラスタ運用なしに堅牢かつ高速なドキュメント指向
DBとしてお使いください!
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
「運用が辛い」
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
から
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
「運用が辛くない!」
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
へ!
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
参考資料
• 公式ページ
https://aws.amazon.com/jp/documentdb/
• ドキュメントやチュートリアルなどのリソース
https://aws.amazon.com/jp/documentdb/develop
er-resources/
• Amazon DocumentDB Forum
https://forums.aws.amazon.com/forum.jspa?foru
mID=332
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Q&A
お答えできなかったご質問については
AWS Japan Blog
「https://aws.amazon.com/jp/blogs/news/」にて
資料公開と併せて、後日掲載します。
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS の日本語資料の場所「AWS 資料」で検索
https://amzn.to/JPArchive
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
公式Twitter/Facebook
AWSの最新情報をお届けします
@awscloud_jp
検索
最新技術情報、イベント情報、お役立ち情報、
お得なキャンペーン情報などを日々更新しています!
もしくは
http://on.fb.me/1vR8yWm
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWSの導入、お問い合わせのご相談
AWSクラウド導入に関するご質問、お見積、資料請求をご希望のお客様は以
下のリンクよりお気軽にご相談下さい。
https://aws.amazon.com/jp/contact-us/aws-sales/
※「AWS 問い合わせ」で検索して下さい。
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS 公式 Webinar
https://amzn.to/JPWebinar
過去資料
https://amzn.to/JPArchive
ご視聴ありがとうございました

More Related Content

More from Amazon Web Services Japan

202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用
202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用
202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用Amazon Web Services Japan
 
202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf
202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf
202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdfAmazon Web Services Japan
 
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介Amazon Web Services Japan
 
Amazon QuickSight の組み込み方法をちょっぴりDD
Amazon QuickSight の組み込み方法をちょっぴりDDAmazon QuickSight の組み込み方法をちょっぴりDD
Amazon QuickSight の組み込み方法をちょっぴりDDAmazon Web Services Japan
 
マルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことマルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことAmazon Web Services Japan
 
機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ
機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ
機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチAmazon Web Services Japan
 
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介Amazon Web Services Japan
 
202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles
202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles
202202 AWS Black Belt Online Seminar Amazon Connect Customer ProfilesAmazon Web Services Japan
 
Amazon Game Tech Night #24 KPIダッシュボードを最速で用意するために
Amazon Game Tech Night #24 KPIダッシュボードを最速で用意するためにAmazon Game Tech Night #24 KPIダッシュボードを最速で用意するために
Amazon Game Tech Night #24 KPIダッシュボードを最速で用意するためにAmazon Web Services Japan
 
202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨
202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨
202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨Amazon Web Services Japan
 
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介Amazon Web Services Japan
 
202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介
202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介
202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介Amazon Web Services Japan
 
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...Amazon Web Services Japan
 
202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ
202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ
202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピAmazon Web Services Japan
 
20211209 Ops-JAWS Re invent2021re-cap-cloud operations
20211209 Ops-JAWS Re invent2021re-cap-cloud operations20211209 Ops-JAWS Re invent2021re-cap-cloud operations
20211209 Ops-JAWS Re invent2021re-cap-cloud operationsAmazon Web Services Japan
 
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報Amazon Web Services Japan
 
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをなAmazon Web Services Japan
 
202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN
202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN
202110 AWS Black Belt Online Seminar AWS Site-to-Site VPNAmazon Web Services Japan
 

More from Amazon Web Services Japan (20)

202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用
202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用
202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用
 
202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf
202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf
202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf
 
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介
 
Amazon QuickSight の組み込み方法をちょっぴりDD
Amazon QuickSight の組み込み方法をちょっぴりDDAmazon QuickSight の組み込み方法をちょっぴりDD
Amazon QuickSight の組み込み方法をちょっぴりDD
 
マルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことマルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのこと
 
機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ
機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ
機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ
 
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
 
202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles
202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles
202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles
 
Amazon Game Tech Night #24 KPIダッシュボードを最速で用意するために
Amazon Game Tech Night #24 KPIダッシュボードを最速で用意するためにAmazon Game Tech Night #24 KPIダッシュボードを最速で用意するために
Amazon Game Tech Night #24 KPIダッシュボードを最速で用意するために
 
202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨
202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨
202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨
 
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介
 
202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介
202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介
202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介
 
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
 
202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ
202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ
202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ
 
20211209 Ops-JAWS Re invent2021re-cap-cloud operations
20211209 Ops-JAWS Re invent2021re-cap-cloud operations20211209 Ops-JAWS Re invent2021re-cap-cloud operations
20211209 Ops-JAWS Re invent2021re-cap-cloud operations
 
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
 
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
 
20211109 JAWS-UG SRE keynotes
20211109 JAWS-UG SRE keynotes20211109 JAWS-UG SRE keynotes
20211109 JAWS-UG SRE keynotes
 
20211109 bleaの使い方(基本編)
20211109 bleaの使い方(基本編)20211109 bleaの使い方(基本編)
20211109 bleaの使い方(基本編)
 
202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN
202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN
202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN
 

Recently uploaded

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

Recently uploaded (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

20190625 AWS Black Belt Online Seminar Amazon DocumentDB

  • 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アマゾン ウェブ サービス ジャパン株式会社 ソリューションアーキテクト 桑野 章弘 2019.06.25 【AWS Black Belt Online Seminar】 Amazon DocumentDB
  • 2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 自己紹介 桑野 章弘(くわの あきひろ) ソリューションアーキテクト 主にメディア系のお客様を担当しております 元渋谷のインフラエンジニア 好きなAWSのサービス:DocumentDB、Aurora、Route53、S3 好きな(?)データストア:MongoDB
  • 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Black Belt Online Seminar とは 「サービス別」「ソリューション別」「業種別」のそれぞれのテーマに分かれて、アマゾ ン ウェブ サービス ジャパン株式会社が主催するオンラインセミナーシリーズです。 質問を投げることができます! • 書き込んだ質問は、主催者にしか見えません • 今後のロードマップに関するご質問は お答えできませんのでご了承下さい ① 吹き出しをクリック ② 質問を入力 ③ Sendをクリック Twitter ハッシュタグは以下をご利用ください #awsblackbelt
  • 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 内容についての注意点 • 本資料では2019年6月25日時点のサービス内容および価格についてご説明しています。最新の情報 はAWS公式ウェブサイト(http://aws.amazon.com)にてご確認ください。 • 資料作成には十分注意しておりますが、資料内の価格とAWS公式ウェブサイト記載の価格に相違が あった場合、AWS公式ウェブサイトの価格を優先とさせていただきます。 • 価格は税抜表記となっています。日本居住者のお客様が東京リージョンを使用する場合、別途消費 税をご請求させていただきます。 • AWS does not offer binding price quotes. AWS pricing is publicly available and is subject to change in accordance with the AWS Customer Agreement available at http://aws.amazon.com/agreement/. Any pricing information included in this document is provided only as an estimate of usage charges for AWS services based on certain information that you have provided. Monthly charges will be based on your actual use of AWS services, and may vary from the estimates provided.
  • 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アジェンダ ドキュメント指向DBとは Amazon DocumentDBの概要 Amazon DocumentDBのアーキテクチャ Amazon DocumentDBの使い方 ベストプラクティス 他サービスとの使い分け 移行方法 料金体系 まとめ
  • 6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アジェンダ ドキュメント指向DBとは Amazon DocumentDBの概要 Amazon DocumentDBのアーキテクチャ Amazon DocumentDBの使い方 Amazon DocumentDBのサービス概要 他サービスとの使い分け 移行方法 料金体系 まとめ
  • 7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. クライアント アプリケー ション データベース JSON != 今までのデータベースのデータ連携の一例 Relational JSONはデータ 連携のデファク トに アプリケー ションはデー タベースから 返ってくる データと JSONの整合 性を取る 整合性のためにオ ブジェクトリレー ショナルマッパー (ORM)が必要 対応コスト増
  • 8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. クライアント アプリケー ション データベース JSON ≒ ドキュメント指向データベースのデータ連携 JSON-Like JSONはデータ 連携のデファク トに アプリケー ションはド キュメント データベース のJSONの整 合性を取るの は最小限です む ORMを使う必要 も限定的となる 対応コスト低:ド キュメントデータ ベースはこの問題 への一つの解とな りうる
  • 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ドキュメント指向データベース • JSON-likeなデータ • ドキュメントはより自然な 形でデータを表現可能 • 柔軟性のあるスキーマ、イ ンデックス • Javascriptで表現可能な柔 軟なクエリ { id: 1, name: ”kuwano", age: 41, email: ”kuwanoa@amazon.com", promotions: ["new user", "5%", ”curry lover"], memberDate: 2015-9-27, shoppingCart: [ {product:"abc", quantity:2, cost:19.99}, {product:"edf", quantity:3, cost: 2.99} ] }
  • 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ドキュメントデータベースのユースケース モバイル アプリ リテール & マーケ ティング ユーザ プロファイル カタログ コンテンツ管理 パーソナライ ゼーション
  • 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ドキュメントデータベースのユースケース ゲームのユーザプロフィール { id: 181276, username: "sue1942", name: {first: "Susan", last: "Benoit"} } { id: 181276, username: "sue1942", name: {first: "Susan", last: "Benoit"}, ExplodingAcorns: { hi_score: 3185400, global_rank: 5139, bonus_levels: true }, promotions: ["new user","5%",”acorn lover"] }
  • 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ドキュメントデータベースのユースケース ゲームのユーザプロフィール { id: 181276, username: "sue1942", name: {first: "Susan", last: "Benoit"} } { id: 181276, username: "sue1942", name: {first: "Susan", last: "Benoit"}, ExplodingAcorns: { hi_score: 3185400, global_rank: 5139, bonus_levels: true }, promotions: ["new user","5%",”acorn lover"] } トロフィーを追加 スコアやランクを追加
  • 13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ドキュメントデータベースのユースケース ゲームのユーザプロフィール { id: 181276, username: "sue1942", name: {first: "Susan", last: "Benoit"}, ExplodingAcorns: { hi_score: 3185400, global_rank: 5139, bonus_levels: true }, promotions: ["new user","5%",”acorn lover"] } { id: 181277, username: ”akuwano", name: {first: ”Akihiro", last: ”Kuwano"}, nickname: ”mongo", ExplodingAcorns: { hi_score: 100, global_rank: 100000, bonus_levels: true }, promotions: ["new user","5%",”curry lover"] } ニックネームを追加
  • 14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ドキュメントデータベースで開発を高速に
  • 15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アジェンダ ドキュメント指向DBとは Amazon DocumentDBの概要 Amazon DocumentDBのアーキテクチャ Amazon DocumentDBの使い方 Amazon DocumentDBのサービス概要 他サービスとの使い分け 移行方法 料金体系 まとめ
  • 16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWSのデータベース
  • 17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Purpose built The right tool for the right job
  • 18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWSのデータベース Relational 参照整合性、 ACIDトラン ザクション、 スキーマ Lift and shift, ERP, CRM, finance Key-value 高スループット、 低レイテンシ、 スケーラ ビリティ Real-time bidding, shopping cart, social, product catalog, customer preferences Document ドキュメント を保存し、任 意の属性にク エリですばや く アクセス Content management, personalization, mobile In-memory マイクロ秒 レベルの keyアクセス Leaderboards, real-time analytics, caching Graph すばやく簡単 にデータ間の 関係を元に グラフ構造を 作成、 ナビゲート Fraud detection, social networking, recommendation engine Time-series 時系列に特化 した形で データの収集、 格納、処理 IoT applications, event tracking Ledger アプリケーション データの全変更を 完全、不変、 検証可能な 履歴として保存 Systems of record, supply chain, health care, registrations, financial
  • 19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWSのデータベース Relational Key-value Document In-memory Graph Time-series Ledger Aurora CommercialCommunity Amazon DocumentDB Amazon DynamoDB Amazon ElastiCache Amazon Neptune Amazon Quantum Ledger Database (QLDB) Amazon RDS Amazon Timestream New!
  • 20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB (with MongoDB Compatibility) Fast, scalable, and fully managed MongoDB-compatible database service
  • 21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 既存のドキュメント指向データベースの課題 管理 スケールセットアップ セキュリティ バックアップ
  • 22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Fast Efficient Optimized Flexible 秒間100万リクエス トが実行可能 効率よくリソースを 実行可能 数分でスケールアウ ト&スケールアップ 可能 ストレージレイヤ でI/Oを最適化 Fast, scalable, fully managed MongoDB-compatible database service Amazon DocumentDB
  • 23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Scale out in minutes Scale up in minutes Autoscaling storage Load balancing 15台のリードレプリ カが追加可能 15-768 GiBのメ モリ容量までス ケールアップ ストレージの自動 拡張 10GB から 64 TB まで リードレプリカでの 負荷分散 Fast, scalable, fully managed MongoDB-compatible database service Amazon DocumentDB
  • 24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Pay-as-you- go pricing Automated Backup and PITR Fault tolerant and self-healing storage S3へのストリー ムバックアップ 3AZ、6 コピー によるデータ 冗長 リードレプリカの 昇格による自動 フェイルオーバ Automatic failover and recovery 必要な分、使った 分だけの課金体系 Fast, scalable, fully managed MongoDB-compatible database service Amazon DocumentDB
  • 25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Fast, scalable, fully managed MongoDB-compatible database service Amazon DocumentDB MongoDB 3.6 API Same drivers, tools Migrate with DMS Replica set emulation MongoDB Community Edition 3.6 との互換性 MongoDB driver や ツール が Amazon DocumentDB で使 用可能 AWS DMS を 使ったライブマイ グレーション (無料枠あり) レプリカセットエ ミュレーションに よる読み取りス ケール https://aws.amazon.com/jp/dms/free-dms/
  • 26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon VPC Default Encryption Safe defaults Compliant VPC のみ TLS、 Encryption at rest (カスタママ ネージドキー使 用) 最適化された 設定値 PCI, ISO, SOC2, HIPAA Security and Compliance Amazon DocumentDB
  • 27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Backup and Point-In-Time Recovery Amazon DocumentDB Automatic backups 35 days of PITR Archive snapshots 自動インクリメンタ ルかつ継続的なスト リーミングバック アップ データベースへ 性能影響のない バックアップ 最大35日の Point-in-time recovery (PITR) 35日以上の場合はス ナップショットも 可能 No performance impact
  • 28. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB の特徴 • マネージドドキュメントデータベースサービス • JSON-likeなデータ群をマネージドする用途に特化したデータスト ア • MongoDBとの互換性 • MongoDB 3.6 系互換API対応 • 高可用性 • ミッションクリティカルワークロードを大規模に運用する場合に効果的 • 高パフォーマンス • ストレージとコンピュートを分離し高いパフォーマンスを実現
  • 29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アジェンダ ドキュメント指向DBとは Amazon DocumentDBの概要 Amazon DocumentDBのアーキテクチャ Amazon DocumentDBの使い方 Amazon DocumentDBのサービス概要 他サービスとの使い分け 移行方法 料金体系 まとめ
  • 30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB アーキテクチャ • 3つのチャレンジ • コンピュートとスト レージの分離 • パーティションへの データ分散 • 6コピーとクオラムによ るデータの堅牢性
  • 31. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. コンピュートとストレージの分離 • コンピュートとストレージを分離することで個別に最適 なスケールを行うことができる コンピュートのスケール ストレージのスケール コンピュート レイヤ ストレージレ イヤ API Query Processor Caching Logging + Storage
  • 32. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. パーティションへのデータ分散 Distributed storage volume パーティションへのデータ分散 AZ1 AZ2 AZ3 Logging + Storage
  • 33. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Logging + Storage Distributed storage volume AZ1 AZ2 AZ3 データを3つのAZに6コピーする 6コピーとクオラムによるデータの堅牢性
  • 34. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Distributed storage volume AZ1 AZ2 AZ3 AWS Region Availability Zone 1 Availability Zone 2 Availability Zone 3 Reads Reads Reads Write s Instance (primary) Instance (replica) Instance (replica) Amazon DocumentDB: オーバービュー クラスタエンドポイント リーダーエンドポイント
  • 35. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Distributed storage volume AZ1 AZ2 AZ3 AWS Region Availability Zone 1 Availability Zone 2 Availability Zone 3 Reads Reads Reads Write s Instance (primary) Instance (replica) Instance (replica) Amazon DocumentDB: エンドポイント クラスタエンドポイント リーダーエンドポイント 書き込みノードを示すクラスタ エンドポイントとリードレプリ カを示すリーダーエンドポイン トが存在
  • 36. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB: スケーリング Distributed storage volume AZ1 AZ2 読み込みキャパシティのスケールをしたい場合 AZ3 最大15台のリードレプリカ, 100万リード/sec
  • 37. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB: 障害復旧 インスタンス障害からの復旧 Distributed storage volume AZ1 AZ2 AZ3
  • 38. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB: 障害復旧 インスタンス障害からの復旧 Distributed storage volume AZ1 AZ2 AZ3 インスタンス障害時は他のイン スタンスへとフェイルオーバす ることで障害復旧を行う
  • 39. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB: 堅牢性 Distributed storage volume AZ1 AZ2 AZ3 データの堅牢性を保つためにデータを6冗長でコピー
  • 40. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB: 堅牢性 Distributed storage volume AZ1 AZ2 AZ3 データの堅牢性を保つためにデータを6冗長でコピー 6つ中4つの書き込みクォーラム 6つ中3つの読み込みクォーラム 修復時には各ノード同士で レプリケーションを実施
  • 41. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Distributed storage volume Availability Zone 1 Availability Zone 2 Availability Zone 3 Instance (primary) Instance (replica) Instance (replica) Amazon S3 Amazon DocumentDB: バックアップ ストリーミングバックアップ データベースへの性能影響のないストリーミングバックアップ スナップショット
  • 42. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. MongoDBの大規模構成例 mongod • データノード mongoc • シャーディング情報を保存 する特殊なデータノード mongos • シャーディング時に適切な シャードへと処理を振り分 けるルーティングプロセス mongod App + mongos mongoc mongoc:シャ ーディング情報 の格納 mongos: シャードルーター 適切なシャードへの 割り振り mongod:実際のデー タの格納 赤の囲みが1シャー ドとなり、シャード 単位で処理をオフ ロードする AZ AZ AZ各AZにノー ド配置
  • 43. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. MongoDBの大規模構成例 mongod • データノード mongoc • シャーディング情報を保存 する特殊なデータノード mongos • シャーディング時に適切な シャードへと処理を振り分 けるルーティングプロセス mongod App + mongos mongoc mongoc:シャ ーディング情報 の格納 mongos: シャードルーター 適切なシャードへの 割り振り mongod:実際のデー タの格納 赤の囲みが1シャー ドとなり、シャード 単位で処理をオフ ロードする AZ AZ AZ各AZにノー ド配置 大規模なMongoDBはシャード 構成を組むことが多い
  • 44. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Distributed storage volume AZ1 AZ2 AZ3 AWS Region Availability Zone 1 Availability Zone 2 Availability Zone 3 Reads Reads Reads Write s Instance (primary) Instance (replica) Instance (replica) Amazon DocumentDB: アーキテクチャ再掲 クラスタエンドポイント リーダーエンドポイント
  • 45. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 何故シャーディングが必要ない? 読み込みスケール シャードしたい要因 書き込みスケール ストレージスケール 15台までのリードレプリカ インスタンスのスケールアップが容易 DocumentDBでの対応 64TBまでのストレージ自動拡張
  • 46. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アジェンダ ドキュメント指向DBとは Amazon DocumentDBの概要 Amazon DocumentDBのアーキテクチャ Amazon DocumentDBの使い方 Amazon DocumentDBのサービス概要 他サービスとの使い分け 移行方法 料金体系 まとめ
  • 47. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アジェンダ ドキュメント指向DBとは Amazon DocumentDBの概要 Amazon DocumentDBのアーキテクチャ Amazon DocumentDBの使い方 Amazon DocumentDBのサービス概要 他サービスとの使い分け 移行方法 料金体系 まとめ
  • 48. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB のサービス概要
  • 49. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB クラスタ • Amazon DocumentDB クラスタ • マスタ (Writer)とリードレプリカ(Reader)をひとまとめにし たもの • Parameter GroupとMaintenance WindowもDBクラスタと各 ノードそれぞれに存在 • フェイルオーバが発生しても常にマスタを参照するクラ スタエンドポイント • リードレプリカ群を指し示すリーダーエンドポイント
  • 50. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. リードレプリカ 可用性 • データベースノードの障害は自動的に 検知され、交換される • データベース処理の障害は自動的に検 知され、リソースはリサイクルされる • リードレプリカは必要に応じて自動的 にマスタに昇格する • どのリードレプリカに対して優先的に フェイルオーバーさせるかを指定でき る Primary Node Primary Nodeマスタ Primary Node Primary Node リード レプリカ Primary Node Primary Node リード レプリカ クラスタ/ インスタンス モニタリング パフォーマンス • リードレプリカによってアプリケーション の読み込みトラフィックをスケールアウト させることができる • 読み込みエンドポイントによってリードレ プリカを跨がって負荷が分散される
  • 51. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. クラウドネイティブストレージエンジンの概要 データは3つのアベイラビリティーゾーンに跨がった 6つのレプリカにコピーされる 継続的に堅牢な Amaon S3 へバックアップされる 継続的にノードやディスクが修復される 修復やホットスポットのリバランスのために 10GBのセグメントユニットで管理されている 読み書きにはレイテンシ耐性を持つクォーラムシステムを使 用している クォーラムのメンバーシップが変更されたとしても書き込み は阻害されない ストレージは使用に応じて自動的に64TBまで拡張される AZ 1 AZ 2 AZ 3 Amazon S3 ストレージ ノード ストレージ ノード ストレージ ノード ストレージ ノード ストレージ ノード ストレージ ノード ストレージ モニタリング
  • 52. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. クラウドネイティブストレージエンジンの耐障害性 ・どこに障害が発生すると仮定するか? セグメント障害(ディスク) ノード障害(マシン) AZ障害(ネットワークやデータセンター) ・想定される障害に対する最適化 6つ中4つの書き込みクォーラム 6つ中3つの読み込みクォーラム 修復時には各ノード同士で レプリケーションを実施 AZ 1 AZ 2 AZ 3 キャッシュ Amazon DocumentDB AZ 1 AZ 2 AZ 3 キャッシュ Amazon DocumentDB
  • 53. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. S3への継続的バックアップ • セグメント毎に定期的にS3へ並列でバックアップが取得されている • バックアップはパフォーマンスや可用性にインパクトを与えることなく絶えず行われている • リストア時には、セグメント毎に適切なスナップショットと必要なログレコードが抽出される • スナップショットへのログレコードの適用は並列に非同期的に実行される セグメントスナップショット ログレコード リカバリポイント セグメント 1 時間 セグメント 2 セグメント 3
  • 54. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. MongoDBとの互換性 • MongoDB Ver.3.6 とのAPI互換性 • Aggregation Pipeline や、インデックス、演算子など の現状の対応状況については下記ドキュメントを参照 https://docs.aws.amazon.com/ja_jp/documentdb/latest/developerguide/functional-differences.html
  • 55. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. セキュリティ : データベース認証 • Salted Challenge Response Authentication Mechanism (SCRAM) をサポート • SCRAM はMongoDB 用のデフォルトの認証メカニズム • SCRAM を利用してMongoDB SDK、mongo シェル、およ び各種ツールを使用して Amazon DocumentDB クラス ターに接続可能
  • 56. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. セキュリティ : 暗号化 通信の暗号化 • TLS対応 • セキュリティグループによる アクセス制御 • IAMポリシー • VPCのサービス提供 • パブリックエンドポイントは現 状作れない 保存データの暗号化 • クライアントからは透過的 • AES-256を使用した暗号化 • KMSを使用 • カスタママネージドキーも使用可
  • 57. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. セキュリティ : 監査ログ • Amazon DocumentDB のAudit logをCloudWatch Logs に直接転送可能 • データ定義言語 (DDL)、認証、認可、およびユーザー管理 イベントが保存される • Filter Patternを設定しMetricsを作成することが可能な ため、CloudWatchを利用したアラートの発報も可能 DDL UME Auth Create event string Create event string Create event string Amazon CloudWatch Logs Amazon DocumentDB https://docs.aws.amazon.com/ja_jp/documentdb/latest/developerguide/event-auditing.html
  • 58. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. モニタリング • CloudWatchメトリクスに各種情報からクエリチューニ ングやスケールアウト、アップを判断 • 主要なメトリクス一覧 メトリクス(一部) 説明 CPUUtilization CPU 使用率 Freeable Memory インスタンスで使用可能な RAM の量 Swap Usage インスタンスによって使用されているスワップスペースの量 Read IOPS、Write IOPS 1秒あたりのディスク読み取りまたは書き込みオペレーションの平均数 Read Latency、Write Latency 読み取りまたは書き込みオペレーションの平均時間 Read Throughput、Write Throughput 1 秒あたりのディスク読み取りまたは書き込みデータの平均量 Disk Queue Depth ディスクに対する読み取りまたは書き込み待機中の I/O オペレーション の数 Network Receive Throughput、Network Transmit Throughput 1 秒あたりのインスタンスに対する送信または受信ネットワークトラ フィックのレート (メガバイト単位)。 DB Connections DB インスタンスに接続されたクライアントセッションの数
  • 59. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 使い分け
  • 60. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon RDSとの使い分け • Amazon RDSを優先的に検 討したほうがよい場合 • トランザクションを 使って信頼性の高いク エリを投げたい • 金融、認証などの事前 定義されたスキーマに 従って使用したい • Oracle、MySQL、 PostgreSQLなどの RDBMSのエコシステム を使いたい場合
  • 61. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DynamoDBとの使い分け • よりスケーラブルに使いた いのであればDynamoDB を選択するほうが良い • データの持ち方として JSONのよりネストした構 造にたいして柔軟にアクセ スさせたいという場合には DocumentDBのほうが開 発工数を下げられる可能性 が高い { "_id" : "1234567889", "userid" : "akuwano", "hobby" : “MongoDB”, "username" : "Akihiro Kuwano”, “info” : { “age” : 41, ”country” : “japan”, ”states” : “tokyo”, } }
  • 62. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 移行方法
  • 63. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 移行パターン 十分な停止時間を 取れる ダンプツール (シンプル) Database Migration Serviceと ダンプのハイブリッド (柔軟・複雑) Database Migration Service (柔軟) 移行完了までを高速 にしたい はい いいえ はい いいえ
  • 64. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ダンプツール • 停止時間は長いが、一番シンプルな方法 • MongoDB標準ツールだけで可能 • mongodump, mongorestore 2. Mongodumpで バックアップの取得 3. 必要ならイン デックス作成 (optional) 4. Mongorestore で バックアップをレストア 1. アプリケーショ ンは旧DBへの書き 込みを停止 5. アプリケーション の向き先を DocumentDB に変更
  • 65. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DMSを活用 • アプリの停止時間は短く、手順もシンプルだがフルロー ドが終わるまで時間がかかる 2. 必要ならイン デックス作成 (optional) 1. アプリケーション は旧DB読み書きを継 続 4. アプリケーション の向き先を DocumentDB に変更 3. DMSでフルロード からCDCを実行
  • 66. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DMSとダンプのハイブリッド • アプリの停止時間は短く、マイグレーション完了までも 高速だが手順が複雑となる 2. Mongodumpで バックアップの取得 3. 必要ならイン デックス作成 (optional) 1. アプリケーション は旧DB読み書きを継 続 6. アプリケーション の向き先を DocumentDB に変更 5. DMSでCDCを実行 4. Mongorestore で バックアップをレストア
  • 67. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. DocumentDB Index Tool ソースのMongoDBからイン デックス情報をExportする事 が可能 • DocumentDBとの互換性 についてインデックス、コ レクション、データベース などのチェック • サポートされていないイン デックスタイプのインデッ クス、コレクションの チェック • などなどを実施 https://github.com/awslabs/amazon-documentdb-tools
  • 68. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 料金体系
  • 69. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Instance (primary) Instance (replica) Instance (replica) Amazon S3 Amazon DocumentDB の料金体系 Instances: Size/hr * count (db.r5.large $0.334/hr) Backup: GB/mo (ストレージクラスタの容量と同量まで無料 $0.023/GB) Storage: GB/mo ($0.12/GB) I/O: Count ($0.24/million) 東京リージョンの場合
  • 70. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon DocumentDB の料金体系 ①インスタンス料金 • r5.large( $0.334/h )から r5.24xl( $16.032/h )まで ②I/O回数 • $0.24 / 100万req ③ストレージ料金 • $0.12 / GB-month ④バックアップストレージ • バックアップストレージ $0.023 / GB-month 東京リージョンの場合
  • 71. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 月額料金計算例 https://aws.amazon.com/jp/documentdb/pricing/ db.r5.large/容量50GB(バックアップ50GB) /平均77.2 iops (月間2億I/Oリクエスト)/リージョン外への通信量 10GB 要素 詳細 時間単位のオンデマンドインスタンス 料金 $240.48 ($0.334 * 24 * 30) データベースストレージおよびI/O 容量 $6 ($0.12 * 50) I/Oリクエスト $60 ($0.24 * 200) バックアップストレージ $0 ※データベースストレージ容量まで無料 データ転送 $1.026 ($0.114 * 9) ※1GBまでは無料 合計 $307.506 東京リージョンの場合
  • 72. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 対応リージョン • 東京 • バージニア • オハイオ • オレゴン • アイルランド • ソウル • フランクフルト
  • 73. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アジェンダ ドキュメント指向DBとは Amazon DocumentDBの概要 Amazon DocumentDBのアーキテクチャ Amazon DocumentDBの使い方 Amazon DocumentDBのサービス概要 他サービスとの使い分け 移行方法 まとめ
  • 74. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. まとめ • マネージドドキュメントデータベースとして Amazon DocumentDB がリリース • ドキュメント指向データベースの選択肢が増えたことで AWSのデータベースソリューリョンとしてより多様な ユースケースに対応可能 • クラスタ運用なしに堅牢かつ高速なドキュメント指向 DBとしてお使いください!
  • 75. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 「運用が辛い」
  • 76. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. から
  • 77. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 「運用が辛くない!」
  • 78. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. へ!
  • 79. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 参考資料 • 公式ページ https://aws.amazon.com/jp/documentdb/ • ドキュメントやチュートリアルなどのリソース https://aws.amazon.com/jp/documentdb/develop er-resources/ • Amazon DocumentDB Forum https://forums.aws.amazon.com/forum.jspa?foru mID=332
  • 80. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Q&A お答えできなかったご質問については AWS Japan Blog 「https://aws.amazon.com/jp/blogs/news/」にて 資料公開と併せて、後日掲載します。
  • 81. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS の日本語資料の場所「AWS 資料」で検索 https://amzn.to/JPArchive
  • 82. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 公式Twitter/Facebook AWSの最新情報をお届けします @awscloud_jp 検索 最新技術情報、イベント情報、お役立ち情報、 お得なキャンペーン情報などを日々更新しています! もしくは http://on.fb.me/1vR8yWm
  • 83. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWSの導入、お問い合わせのご相談 AWSクラウド導入に関するご質問、お見積、資料請求をご希望のお客様は以 下のリンクよりお気軽にご相談下さい。 https://aws.amazon.com/jp/contact-us/aws-sales/ ※「AWS 問い合わせ」で検索して下さい。
  • 84. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS 公式 Webinar https://amzn.to/JPWebinar 過去資料 https://amzn.to/JPArchive ご視聴ありがとうございました