More Related Content
More from Amazon Web Services Japan (20)
20200414 Introduction to Amazon Elasticsearch Service
- 1. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Amazon Web Services Japan, K. K.
Analytics Solutions Architect, Makoto Shimura
[これから始める Amazon Elastic Search Service セミナー]
Introduction to
Amazon Elasticsearch Service
- 2. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
⾃⼰紹介
志村 誠
ソリューションアーキテクト
• データ分析・機械学習系サービスを担当
• 好きなサービス
• Amazon Athena
• AWS Glue
• Amazon SageMaker
• and Amazon Elasticsearch Service!!
- 3. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Agenda
• Elasticsearch とは
• Amazon Elasticsearch Service の概要
• 検索
• ログ分析
• まとめ
- 4. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Elasticsearch とは
- 5. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Elasticsearch
• 様々なユースケースを解決する分散型
RESTful 検索/分析エンジン
• コアエンジン部はオープンソースソフ
トウェアとして提供され,主に Elastic
社によって開発が⾏われている
• Elasticsearch に付随するソフトウェア
として,データ取り込みの Logstash
や Beats,可視化⽤の Kibana などが
ある
可視化
検索・分析
収集
- 6. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
データ挿⼊から活⽤までの流れ
アプリケーション
データ
サーバ,アプリ,
ネットワーク,
AWS 等のログ
1
Elasticsearch クラスター
2
アプリユーザ,アナリスト,
DevOps 担当,セキュリティ担当
3
1
JSON 形式のデータを
REST API 経由で送信
2
インデックスに格納された
全てのデータが検索可能
3
REST API 経由でクエリ
複雑な検索・分析条件に対応
- 7. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Elasticsearch における論理的なデータの持ち⽅
=
index document
field
インデックス / ドキュメント / フィールドは,⾮常に荒い例えをするなら,
データベースにおける Table/Record/Column に近い概念 *
* バージョン 6.x までの Elasticsearch には type という概念があったが,7.0 以降では廃止されている
ID ID ID ID ID
ID ID ID ID ID
ID: 34171
{
“first_name”: “Jane”,
“last_name”: “Smith”,
“age”: 28,
“about”: ”I love AWS”,
“interests”: [“music”],
“role”: {
“level”: 7,
“role”: “Architect”
}
}
- 8. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Elasticsearch における物理的なデータの持ち⽅
マスター
マスター
候補
マスター
候補
データノード
マスター (候補) ノード
Elasticsearch クラスター
- 9. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
論理的な index の物理的な配置
• インデックスは内部的に,シャードというデータブロックに分割される
1 2
4 3
シャード数 4 のインデックス
- 10. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
論理的な index の物理的な配置
• インデックスは内部的に,シャードというデータブロックに分割される
• インデックス作成時に,シャード数と,シャードのレプリカ数を指定
1 2
4 3
シャード数 4,レプリカ数 2 のインデックス
プライマリ
シャード
1 1
レプリカ
シャード
- 11. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
論理的な index の物理的な配置
• インデックスは内部的に,シャードというデータブロックに分割される
• インデックス作成時に,シャード数と,シャードのレプリカ数を指定
• レプリカが複数のノードに渡って保存されることで,データの可⽤性や耐久
性を⾼く保つことが可能
シャード数 4,レプリカ数 2 のインデックス
1
32
2
43
1
42
1
43
- 12. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
全⽂検索から分析エンジンへと進化
⾃然⾔語
フィルタリング
スコアリング
全⽂検索
⼤量のデータ挿⼊
ニアリアルタイム
分散ストレージ
ストリームデータ
時系列データの可視化
複雑な条件による集計
応⽤的な分析
分析
00101101001011100010
11110011000000110001
00110010001100110011
0100001101010011
- 13. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
IT 運⽤監視 セキュリティ情報や
イベントの管理
アプリケーションの
監視や分析
IoT 機器の
監視やデータ分析
アプリケーションの
検索機能
ターゲテイング
広告
さまざまなユースケース
- 14. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Amazon Elasticsearch Service の概要
- 15. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Amazon Elasticsearch Service とは
Amazon Elasticsearch Service
(Amazon ES) は,Elasticsearch
と Kibana を簡単にデプロイ・管
理し,スケールさせることが可能
なフルマネージドサービス
- 16. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
フルマネージド
API とコンソール経由で,
数分でクラスターを
デプロイして利⽤可能
柔軟性
データの検索や
ログの分析を実⾏可能
AWS およびオープンソースの
データ収集ツールに対応
コスト効率
使った分だけの従量課⾦
運⽤コストを削減可能
適切なイスンタンスタイプを選択
RI を活⽤
⾼い可⽤性
24x7 のモニタリング
数クリックでマルチ AZ に対応
⾃動でスナップショットを取得
Amazon CloudWatch でメトリクス収集
スケーラブルで
⾼いパフォーマンス
1 クリックで
クラスタサイズの変更,
バージョンアップグレード,
パッチ適⽤が可能
セキュリティと認証
Amazon VPC へのデプロイ
Amazon Cognito で認証認可
FISMA, SOC, PCI, FedRamp 取得
Amazon Elasticsearch Service の利点
- 17. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
典型的なアーキテクチャ
AWS Cloud
VPC
Data Nodes Master Nodes
AWS Management
Console
AWS Command Line Interface
AWS Tools and SDKs
AWS CloudFormation
AWS Identity and
Access
Management
(IAM)
Elastic Load Balancing
(ELB)
AWS
CloudTrail
Amazon
CloudWatch
AWS Database
Migration
Service
Amazon Kinesis
Data Firehose
Amazon
CloudWatch
Logs
Amazon ES Domain
- 18. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Amazon ES を活⽤している多くのお客さま
改善につながるインサイト
アプリ API の利⽤状況,インフ
ラの起動時間,セキュリティ等の
ログで取得して,改善につなげる
ルートコーズの発⾒
ログからエラーメッセージや
サーバ ID を検索して,起
こっている問題の原因を把握
リアルタイムに対応
データをリアルタイムで取得,
可視化,そしてダッシュボー
ドにまとめることで,問題に
素早く対処できるように
データの検索
アプリケーションデータに
関連する検索結果を返す
ログの集約
インフラやアプリケーション
の情報を集約する
単⼀ダッシュボードの作成
セキュリティ監視
不正利⽤,DDoS,その他の
サイバー攻撃に対して
適切なアクションを取る
Nike
- 19. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
検索
- 20. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
典型的なユースケース
- 21. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
典型的なユースケース
映画に関する以下のような情報
を,構造化された形で保持し,
検索できる必要がある
• タイトル
• 概要
• レーティング
• 監督
• 脚本家
• 俳優 etc...
- 22. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
データフロー
表⽰ アプリ データベース
配信 ページ
レンダリング
Business
logic
メインのカタログ
Source of Truth
⼤量のイベントデー
タ(クリック,レー
ティング,位置情報
等)
クエリに基づく動画
の検索を可能に
Amazon CloudFront Amazon EC2 Amazon EC2
Amazon RDS
Amazon DynamoDB
Amazon Elasticsearch
Service
- 23. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
{
"id" : "tt0371746",
"title" : "Iron Man",
"release_date" : "2008-04-14T00:00:00Z",
"actors" : [
"Robert Downey Jr.",
"Gwyneth Paltrow",
"Terrence Howard"
],
"directors" : [
"Jon Favreau"
],
"rating" : 7.9,
"rank" : 171,
"running_time_secs" : 7560,
"genres" : [
"Action",
"Adventure",
"Sci-Fi"
],
"plot" : "When wealthy industrialist Tony Stark
is forced to build an armored suit after a life-
threatening incident, he ultimately decides to use
its technology to fight against evil.",
}
RDS / DynamoDB から
取得した情報を,
構造化された JSON 形式で
Elasticsearch に格納
- 24. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
_search API を通じて Elasticsearch のデータを検索
Amazon ES
- 25. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Compass さま: 不動産プラットフォームの物件検索
データサイズ: 1.2 億件の物件リスト, 1.4 億の売買履歴,1500 の属性情報
利⽤頻度: 1 ⽇に 1 億件の検索
https://www.youtube.com/watch?v=V8yaocQZpr0
- 26. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
ログ分析
- 27. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
ストリームでのログ追加のフロー
VPC
- 28. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
ファイル単位でのログ追加のフロー
- 29. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Kibana による可視化
- 30. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Kibana の裏側
- 31. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
_search API を通じて Elasticsearch のデータを分析
Amazon ES
- 32. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Expedia さま: ログを集約して開発プロセスの改善
• 150 以上の Amazon ES クラスター
• 450 台以上の EC2 インスタンス
• 30 TB 以上のデータと,300 億ものドキュメント
https://www.slideshare.net/AmazonWebServices/abd331log-analytics-at-expedia-using-amazon-elasticsearch-service
AWS
CloudTrail
Amazon S3 Amazon
SNS
log delivery
CloudTrail
message to SNS
objectCreate (all)
Triggers
Lambda
Kibana Amazon ES
Visualize logs
Create
dashboards
AWS
Lambda
Read log from S3
Store in
Elasticsearch
- 33. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
まとめ
- 34. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
まとめ
• Elasticsearch は,オープンソースの検索/分析エンジンで,全⽂検索⽤途だけ
でなく,ストリームデータの可視化や分析などさまざまな⽤途で使われる
• Amazon ES は,Elasticsearch と可視化ソフトウェア Kibana を簡単に構築,
運⽤,スケールさせることができるマネージドサービス
• AWS サービスと連携して,検索やログ分析の仕組みを簡単に構築し,ウェブ
サイトの検索基盤や,ログデータのリアルタイムダッシュボードとして利⽤
可能