20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

9
Copyright (c) 2011 Happy-Camper Street. All Rights Reserved. Presented: 2011-07-08 第 1 回分散処理ワークショップ ‥> @ueshin [email protected] http://happy-camper.st/ 第 1 回分散処理ワークショップ in Tokyo HBase とは? HBase とは? データモデル 物理配置 HBase の特徴 システム構成 事例

Transcript of 20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

Page 1: 20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

Copyright (c) 2011 Happy-Camper Street. All Rights Reserved.

Presented: 2011-07-08

第 1回分散処理ワークショップ‥>

@[email protected]://happy-camper.st/

第 1回分散処理ワークショップ in Tokyo

HBase とは?

HBase とは? データモデル 物理配置HBase の特徴システム構成事例

Page 2: 20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

Copyright (c) 2011 Happy-Camper Street. All Rights Reserved.

Presented: 2011-07-08

第 1回分散処理ワークショップ‥> HBase とは?

HBase is the Hadoop database.

- 大規模データ (billions of rows X millions of columns)

- ランダムアクセス・リアルタイム読み書き

カラム指向分散データベース

- Bigtable: A Distributed Storage System for Structured Data

- Hadoop (HDFS) 上に構築

・自動シャーディング

・テーブル構造が柔軟

・インデックスなし

・クエリが単純化

・Hadoop MapReduce サポート

・一貫性、CAS 操作

・高可用性

・・・

HBase とは? データモデル 物理配置HBase の特徴システム構成事例

Page 3: 20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

Copyright (c) 2011 Happy-Camper Street. All Rights Reserved.

Presented: 2011-07-08

第 1回分散処理ワークショップ‥> データモデル

Bigtable を参考に

Column "contents:" Column "anchor:" Row Key Time Stamp

"com.cnn.www" "CNN"

"CNN.com"

"anchor:cnnsi.com"

"anchor:my.look.ca"

"<html>..."

"<html>..."

"<html>..."

t8

t6

t5

t3

t9

セルの値を取得するには・・・

  - テーブル名

  - Row Key

  - カラムファミリー

  - 修飾子

  - バージョン

Row = Map<byte[], Map<byte[], Map<Long, byte[]>>>

実際問題、こんな感じ。

例 ) webtable

- 行の特定に Row Key

- あるカラムファミリーに対して、任意の数のカラムを持てる

RowKey Column Version

Value

HBase とは? データモデル 物理配置HBase の特徴システム構成事例

Page 4: 20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

Copyright (c) 2011 Happy-Camper Street. All Rights Reserved.

Presented: 2011-07-08

第 1回分散処理ワークショップ‥> 物理配置

物理的には、カラムファミリー毎に保存

リージョン

Row Key の範囲によって分割された領域- リージョンのサイズが大きくなると自動的に分割されていく

Column "contents:" Row Key Time Stamp

"jp.co.cnn"

"<html>..."

"<html>..."

"<html>..." t5

t3

t6

Column "anchor:" Row Key Time Stamp

"jp.co.cnn" "CNN"

"CNN.com"

"anchor:cnnsi.com"

"anchor:my.look.ca" t8

t9

Column "mime:" Row Key Time Stamp

"jp.co.cnn" "text/html"t9

リージョン2

Column "contents:" Row Key Time Stamp

"com.cnn.www"

"<html>..."

"<html>..."

"<html>..." t5

t3

t6

Column "anchor:" Row Key Time Stamp

"com.cnn.www" "CNN"

"CNN.com"

"anchor:cnnsi.com"

"anchor:my.look.ca" t8

t9

リージョン1

HBase とは? データモデル 物理配置HBase の特徴システム構成事例

Page 5: 20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

Copyright (c) 2011 Happy-Camper Street. All Rights Reserved.

Presented: 2011-07-08

第 1回分散処理ワークショップ‥> システム構成

DataNode

TaskTracker

RegionServer

DataNode

TaskTracker

RegionServer

DataNode

TaskTracker

RegionServer

DataNode

TaskTracker

RegionServer

NameNode

JobTracker

HMaster ZooKeeper

ZooKeeper

ZooKeeper

HBase とは? データモデル 物理配置HBase の特徴システム構成事例

Page 6: 20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

Copyright (c) 2011 Happy-Camper Street. All Rights Reserved.

Presented: 2011-07-08

第 1回分散処理ワークショップ‥> システム構成

マスター

ワーカー

Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz

8GB mem / 420GB HDD

NameNode / SecondaryNameNode

JobTracker

HMaster

・Intel(R) Core(TM)2 Quad CPU Q9650 @ 3.00GHz

・Intel(R) Xeon(R) CPU X3370 @ 3.00GHz

8GB mem / 160GB + 750GB HDD

DataNode

TaskTracker

RegionServer

ZooKeeper

HBase とは? データモデル 物理配置HBase の特徴システム構成事例

Page 7: 20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

Copyright (c) 2011 Happy-Camper Street. All Rights Reserved.

Presented: 2011-07-08

第 1回分散処理ワークショップ‥> HBase の特徴

高い書き込みスループット

WAL(Write Ahead Log) をシーケンシャルに書きこみ

実データはメモリで更新

メモリ上のデータは定期的にフラッシュ

水平方向のスケーラビリティ

RegionServer を追加すれば Region を再配分

自動フェイルオーバー

RegionServer がダウンしたら生きている RegionServer でリカバリ

HBase とは? データモデル 物理配置HBase の特徴システム構成事例

Page 8: 20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

Copyright (c) 2011 Happy-Camper Street. All Rights Reserved.

Presented: 2011-07-08

第 1回分散処理ワークショップ‥> HBase の特徴

リージョンの動的なシェーディング

Region がある程度のサイズになると分割

増えた Region は再分配

HDFS と ZooKeeper を利用

故障への耐性

スケーラビリティ

チェックサムで損傷を修復

MapReduce

ペタバイト規模での十分なテストと利用実績

強い一貫性

行に対する操作はアトミック

CAS 操作 ( checkAndPut / incrementColumnValue )

HBase とは? データモデル 物理配置HBase の特徴システム構成事例

Page 9: 20110708 h baseとは?(第1回分散処理ワークショップ in tokyo)

Copyright (c) 2011 Happy-Camper Street. All Rights Reserved.

Presented: 2011-07-08

第 1回分散処理ワークショップ‥>

事例

FacebookTitan (Facebook Message)Puma (Facebook Insight)ODS (Facebook Metrics)

MozillaScorro

http://code.google.com/p/socorro/

Socorro is a server to accept and process Breakpad crash reports.

OpenTSDB

OpenTSDB is a distributed, scalable Time Series Database (TSDB) written on top of HBase.

http://opentsdb.net/

Lily CMS

Lily is Smart Data, at Scale, made Easy.

http://www.lilyproject.org/lily/index.html

HBase とは? データモデル 物理配置HBase の特徴システム構成事例