Effective 'Hadoop on Azure' ~HDInsight とゆかいな...
Transcript of Effective 'Hadoop on Azure' ~HDInsight とゆかいな...
![Page 1: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/1.jpg)
ROOM
D
![Page 2: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/2.jpg)
![Page 3: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/3.jpg)
![Page 4: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/4.jpg)
数多くのコンピューターやデバイスで生成されるデータを、たった一台で分析するのは限界があります。
一人じゃムリ…
複数のコンピューターによる並列分散処理が必要です。
手分けしよう!
![Page 5: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/5.jpg)
Apache の分散コンピューティングフレームワーク
Google の論文が契機となって誕生!
多数のサーバーで分散処理
Yahoo や Facebookで使われている高スケーラビリティ
http://hadoop.apache.org/
![Page 6: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/6.jpg)
![Page 7: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/7.jpg)
HDInsight 最新情報
![Page 8: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/8.jpg)
![Page 9: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/9.jpg)
![Page 10: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/10.jpg)
Azure データセンター
サブネット1
サブネット2
仮想ネットワーク(例: 10.1.0.0/16)
Azure仮想マシン
HDInsight クラスター
Azure VM(IaaS)との連携が容易に
![Page 11: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/11.jpg)
サイズ コア数 メモリ(GB) 備考
A3 4 7汎用インスタンス
A4 8 14
A6 4 28 Aシリーズのメモリ集中型A7 8 56
A10 8 56 高性能インスタンスXeon E5-2670
2.6 GHzA11 16 112
D3 4 14
Aシリーズより高速なCPUと大きなメモリ
SSDを装備
D4 8 28
D12 4 28
D13 8 56
D14 16 112
![Page 12: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/12.jpg)
ゲスト OS は
Ubuntu 12.04 LTS
Ambari による管理
現在のところ以下の
4リージョンで利用可能
US South Central
US East 2
Europe North
Asia South East
![Page 13: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/13.jpg)
Cloudera Enterprise
CDH 5
Hortonworks Data Platform
HDP 2.2
Hortonworks Sandbox シングルノード構成の
テスト用 HDP
いずれも、Azure の
「仮想マシン」機能を使った Linux
版のクラスタです
![Page 14: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/14.jpg)
HDInsight アーキテクチャおさらい
![Page 15: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/15.jpg)
![Page 16: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/16.jpg)
![Page 17: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/17.jpg)
![Page 18: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/18.jpg)
![Page 19: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/19.jpg)
HDInsight
その他のHadoop on Azure
Windows 版
Linux 版
CDH(Cloudera)
HDP(Hortonworks)
“WASB”
ブロック BLOB をダイレクトに使う
“HDFS on BLOB”
Azure 仮想マシンのデータディスクを
束ねて HDFS を構成
![Page 20: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/20.jpg)
WASB
HDInsight の
デフォルト
ファイルシステム
個々のファイルは
ブロックBLOB
同時に読み書きする
ファイル数が増えると
スループットも増大
HDInsight データノード
NativeAzureFileSystem
001.log
002.log
003.log
004.log
005.log
NativeAzureFileSystem
NativeAzureFileSystem
![Page 21: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/21.jpg)
BLOB ストレージ
データディスク
Azure VMによるデータノード
データディスク
Azure VMによるデータノード
データディスク
BLOBキャッシュ
BLOBキャッシュ
個々のVHDは
ページBLOB
Hadoop は
これをローカル
ディスクだと
思ってHDFSを
組むが、実際は
リモート
Disk1.vhd
Disk2.vhd
Disk3.vhd
Disk4.vhd
Disk5.vhd
Disk6.vhdBLOBキャッシュ
![Page 22: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/22.jpg)
M
Extent Nodes (EN)
Paxos
フロントエンド層 FE
書き込み要求
M
M
Partition
Server
Partition
Server
Partition
Server
Partition
Server
Partition
MasterLock
Service
Ack
パーティション層
ストリーム層
FE FE FE FE
![Page 23: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/23.jpg)
コンテナ名 + BLOB 名
Azure 仮想マシンの「1ディスク 500 IOPS」はここから来ています。
http://azure.microsoft.com/en-us/documentation/articles/storage-scalability-targets/
![Page 24: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/24.jpg)
WASB
HDFSon
BLOB
001.log
002.log
003.log
004.log
EN
EN
EN
EN
EN
EN
PS
PS
PS
PS ENEN
001.log
002.log
003.log
004.log
disk1.vhd
PS = パーティション サーバー
EN = エクステント ノード
001.log
002.log
003.log
004.log
EN
EN
EN
EN
EN
EN
PS
PS
PS
PS ENEN
![Page 25: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/25.jpg)
http://azure.microsoft.com/en-us/documentation/articles/storage-scalability-targets/
リージョン 操作スループット (Gbps)
GRS LRS
USRead 20 30
Write 10 20
US以外Read 10 15
Write 5 10
GRS: 地理冗長 = 2リージョンにまたがる 6 多重複製
LRS: ローカル冗長 = 1リージョン内での 3多重複製
![Page 26: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/26.jpg)
![Page 27: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/27.jpg)
SQL on Hadoop の活用
![Page 28: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/28.jpg)
①
②
![Page 29: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/29.jpg)
Mapper
Reducer
左の例は、単語毎の出現回数を数える Map 処理。
StringTokenizer を使って自分で文字列を単語単位に
分解し、「いま、”・・・”という単語があった」と
記録(OutputCollector に出力)していく。
「Hadoop は非構造化データの処理に向く」というのは、
「単なる文字列を全部自分で処理する」ということ!
こちらは Reduce 処理。
Map 処理の出力は、Hadoop によってキー毎に集約され、
reduce メソッドに渡される。イメージとしては、
(“単語1”: [1,1,1])
(“単語2”: [1,1])
のような「キー:値」形式のデータ。
「“単語1”は値が3つ入っているので3回出現した」、
という感じで数えていく。
![Page 30: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/30.jpg)
![Page 31: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/31.jpg)
Hive, Impala, Presto...
SQL(的な)クエリで Hadoop に対する処理を行うことのできる関連プロジェクトがいくつか
あります。おそらく一番歴史が長くて有名なのが、Facebookによって開発された”Hive”です。
(https://hive.apache.org/)
2013-08-26 23:59:03 W3SVC1 192.168.0.1 GET /…2013-08-26 23:59:05 W3SVC1 192.168.0.1 GET /…2013-08-26 23:59:25 W3SVC1 192.168.0.1 GET /…2013-08-27 00:01:02 W3SVC1 192.168.0.1 GET /…2013-08-27 00:02:04 W3SVC1 192.168.0.1 GET /…
こういうファイルを
date time sitename s-ip method uri
2013-08-26 23:59:03 W3SVC1 192.168.0.1 GET /...
2013-08-26 23:59:05 W3SVC1 192.168.0.1 GET /...
2013-08-26 23:59:25 W3SVC1 192.168.0.1 GET /...
2013-08-26 00:01:02 W3SVC1 192.168.0.1 GET /...
2013-08-26 00:02:04 W3SVC1 192.168.0.1 GET /...
こんなテーブルだと思ってクエリを投げられます
![Page 32: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/32.jpg)
![Page 33: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/33.jpg)
HDInsight 専用の Web 画面から Hive を利用できます
クエリの実行
ファイルシステムの探索
![Page 34: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/34.jpg)
Visual Studio から Hive のテーブル作成やジョブ投入
ジョブの出力結果や
ログも確認可能
テーブル名等の補完機能
![Page 35: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/35.jpg)
クラスタ作成
Hive ジョブ投入
多数の PC から収集した操作ログを週次のバッチ処理で分析
Hive
ジョブ
実行
![Page 36: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/36.jpg)
![Page 37: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/37.jpg)
![Page 38: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/38.jpg)
スループット: 高い
レイテンシも: 大きい
![Page 39: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/39.jpg)
![Page 40: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/40.jpg)
![Page 41: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/41.jpg)
![Page 42: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/42.jpg)
MapReduceに依存しない、高速な分散 SQL エンジン
オーバーヘッドを回避するため、
MapReduceを使わずHDFSに直接アクセス。
HiveQL のサブセットでクエリを記述。
「速い Hive」的に使える。
Cloudera Enterprise で利用可能
Azure Marketplace に試用版の
テンプレートが用意されています。
![Page 43: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/43.jpg)
![Page 45: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/45.jpg)
http://jp.hortonworks.com/wp-content/uploads/2013/05/H1H2Tez.png
![Page 46: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/46.jpg)
set hive.execution.engine=mr;
set hive.execution.engine=tez;
![Page 47: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/47.jpg)
72.8
14.4
MapReduce Tez
61,000,000行(10GB) のデータを4ノードで処理
Tez を有効にするだけで
5 倍の高速化
![Page 48: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/48.jpg)
https://maniax.jp/
• アクセス数の多いURI:上位10件• 多く利用されているユーザーエージェント:上位10件• URI ごとの平均レスポンスタイム: 長いほうから10件
TuningManiax ~ Hadoop コース ~
![Page 49: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/49.jpg)
![Page 50: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/50.jpg)
Azure Storage Analytics のログ解析を HDInsight の Hive で
まず、ログの記録を
有効にします。
http://azure.microsoft.com/ja-jp/documentation/articles/storage-monitor-storage-account/
旧ポータルでも OK
![Page 51: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/51.jpg)
BLOB ストレージにあるものは HDInsight にとって格好の標的
$logs コンテナにログファイルが作成されます。
読むのは結構大変です…※ しかも改行が LF なので Windows にやさしくありません
![Page 52: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/52.jpg)
https://msdn.microsoft.com/ja-jp/library/azure/hh343259.aspx
こんな感じで外部表にしてみます
ログのフィールド定義はこちら
$logs はデフォルトコンテナではないので、
wasb:// のフルパス指定が必要
![Page 53: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/53.jpg)
「アクセスの多いファイル TOP10」を問い合わせてみます
select requesturl,count(*) as col2 from bloblog
group by requesturl order by col2 desc limit 10;
"http://decode2015.blob.core.windows.net:80/storminsight32/user/hdp/share/lib" 28659"http://decode2015.blob.core.windows.net:80/hbaseinsight?delimiter=%2F& 18422"http://decode2015.blob.core.windows.net:80/storminsight32?delimiter=%2F& 18419"http://decode2015.blob.core.windows.net:80/sparktest32?comp=list& 17731"http://decode2015.blob.core.windows.net:80/hbaseinsight/user/hdp/share/lib" 17180"http://decode2015.blob.core.windows.net:80/hbaseinsight/hbase/oldWALs" 16895"http://decode2015.blob.core.windows.net:80/hbaseinsight?comp=list& 16161"http://decode2015.blob.core.windows.net:80/gpx/SLR210.gpx" 15883"http://decode2015.blob.core.windows.net:80/sparktest32/user/hdp/share/lib" 14900"http://decode2015.blob.core.windows.net:80/$logs?comp=list& 14666Time taken: 146.661 seconds, Fetched: 10 row(s)
![Page 54: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/54.jpg)
適切なファイル形式の選択で改善可能
![Page 55: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/55.jpg)
「生テキスト」だけじゃない。Hadoop 界もカラム型が流行!
格納形式 説明
TEXTFILE テキストファイルそのまま
SEQUENCEFILE バイナリのキーと値からなるレコードの連続体
RCFILE Hive 用に導入されたカラム型フォーマット
ORCFILE RCFile を Hortonworks が改良したもの
PARQUET Twitter / Cloudera によるカラム型フォーマット
![Page 56: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/56.jpg)
Parquet の構造ORCFile の構造
http://parquet.apache.org/https://github.com/hortonworks/orc
![Page 57: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/57.jpg)
146.661
25.427
external ORC
100万レコードの解析時間
![Page 58: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/58.jpg)
サンプルギャラリーに
詳細な説明があります。
テーブルの作成や、クエリの
実行といった操作も、
この画面から行えます。
![Page 59: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/59.jpg)
![Page 60: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/60.jpg)
大量の
蓄積された
今まさに発生中の
データに対する
バッチ
リアルタイム
処理
• ログファイルの分析• 全文検索用インデックスの生成
![Page 61: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/61.jpg)
cat ファイル |
cat ファイル |
Map
Map
cat ファイル | sort |Map Reduce > ファイル
入力ファイル群をシーケンシャルに処理
UNIX コマンドによるテキストファイル処理に例えられます
![Page 62: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/62.jpg)
![Page 63: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/63.jpg)
![Page 64: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/64.jpg)
Twitter 分析を行っていた BackType 社が開発
Twitter が BackType を買収したことでTwitter から OSS として公開される
その後、2014年9月にASFのトップレベル プロジェクトとなる
スケーラブルな分散 CEP 基盤
![Page 65: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/65.jpg)
大量の
蓄積された
今まさに発生中の
データに対する
バッチ
リアルタイム
処理
![Page 66: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/66.jpg)
Spout, Bolt, Streamを組み合わせ Topology を定義
Spout Bolt
Topology
Bolt BoltSpout
BoltStream
Tuple Tuple
Spout から流れてくる Tuple を Bolt が処理
![Page 67: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/67.jpg)
Storm 専用のクラスターを作成可能です。
2015年2月にGA済み。
HDInsight のバージョンは 3.1 と 3.2 を選択可能ですが、3.2をオススメ(理由は後述)
http://azure.microsoft.com/ja-jp/updates/general-availability-apache-storm-on-hdinsight/
![Page 68: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/68.jpg)
Storm による処理フローの例
ログファイル
センサ
データ
モバイルデバイス
メッセージング
システム Storm
ダッシュボード
データストア
![Page 69: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/69.jpg)
![Page 70: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/70.jpg)
ログファイル
センサ
データ
モバイルデバイス HDInsight
Storm
on
HDInsight
Azure
Event Hubs
Power BIダッシュボード
![Page 71: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/71.jpg)
Event Hubs との連携モジュール
storm-eventhubs
Visual Studio をStormトポロジの
開発環境に!
Power BI でリアルタイム
ダッシュボード
![Page 72: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/72.jpg)
Event HubSpout
Bolt
Event Hubs と Storm の連携機能を提供
Event Hub からデータを取り込む
”Event Hub Spout”
Event HubBolt
SpoutEvent Hub へ
データを書き込む”Event Hub Bolt”
![Page 73: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/73.jpg)
https://github.com/apache/storm/tree/master/external/storm-eventhubs
Event Hub Spout 等を含む、Event Hub とStormの連携モジュール。
Storm 本家リポジトリに取り込まれています。
Pull Request はこちらhttps://github.com/apache/storm/pull/336
![Page 74: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/74.jpg)
HDInsight Tools for Visual Studio
Storm トポロジ作成用のプロジェクトテンプレート
C#でSpoutやBoltを開発
![Page 75: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/75.jpg)
作成したトポロジをその場で HDInsight へ
投入したトポロジの実行状態を確認
トポロジ内の Spout, Bolt の処理状況やログを確認
![Page 76: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/76.jpg)
https://github.com/Vtek/PowerBI.Api.Client
このライブラリを使います
2. データセットを定義したら3. Insert するだけ
1. Azure AD の資格情報
簡単!
![Page 77: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/77.jpg)
「HDInsight で Storm を使用して Azure Event Hub のイベントを処理する (#C)」http://azure.microsoft.com/ja-jp/documentation/articles/hdinsight-storm-develop-csharp-event-hub-topology/
「Visual Studio を使用して HDInsight で Apache Storm のC# トポロジを開発する」http://azure.microsoft.com/ja-jp/documentation/articles/hdinsight-storm-develop-csharp-visual-studio-topology/
「Power BI (プレビュー) を使用して Storm トポロジのデータを視覚化する」http://azure.microsoft.com/ja-jp/documentation/articles/hdinsight-storm-power-bi-topology/
![Page 78: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/78.jpg)
![Page 79: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/79.jpg)
アンケートにご協力ください。
●アンケートに 上記の Session ID のブレイクアウトセッションに
チェックを入れて下さい。
●アンケートはお帰りの際に、受付でご提出ください。
マイクロソフトスペシャルグッズと引換えさせていただきます。
![Page 80: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/80.jpg)
ROOM
D
![Page 81: Effective 'Hadoop on Azure' ~HDInsight とゆかいな …download.microsoft.com/download/3/6/0/360BDD2D-B340-4AB9...HDInsight 専用のWeb 画面からHive を利用できます](https://reader030.fdocuments.net/reader030/viewer/2022041017/5ec9cb5bef49976c6804f6d4/html5/thumbnails/81.jpg)