10
Presented: 06/16/2011 Copyright © 2011 Happy-Camper Street. Presentation Presented: 06/16/2011 HBase アーキテクチャ概要 HBase サーバー構成 データモデル 実装 HBase アーキテクチャ概要 HBase ア ー キ テ ク チ ャ 概 要 @ueshin [email protected] http://happy-camper.st/

20110616 HBaseアーキテクチャ概要

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: 20110616 HBaseアーキテクチャ概要

Presented: 06/16/2011Copyright © 2011 Happy-Camper Street.

Presentation

Presented: 06/16/2011

HBase アーキテクチャ概要

HBaseサーバー構成

データモデル

実装

HBaseアーキテクチャ概要

HBase アーキテクチャ概要

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

Page 2: 20110616 HBaseアーキテクチャ概要

Presented: 06/16/2011Copyright © 2011 Happy-Camper Street.

Presentation

Presented: 06/16/2011

HBaseアーキテクチャ概要

HBaseサーバー構成

データモデル

実装

HBaseアーキテクチャ概要 > HBase サーバー構成

HBase サーバー構成

マスター

ワーカー

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

Page 3: 20110616 HBaseアーキテクチャ概要

Presented: 06/16/2011Copyright © 2011 Happy-Camper Street.

Presentation

Presented: 06/16/2011

データモデルBigtable を参考に

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

"com.cnn.www" "CNN"

"CNN.com"

"text/html"

"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

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

HBaseアーキテクチャ概要 > データモデル

HBaseアーキテクチャ概要

HBaseサーバー構成

データモデル

実装

物理配置

その他

Page 4: 20110616 HBaseアーキテクチャ概要

Presented: 06/16/2011Copyright © 2011 Happy-Camper Street.

Presentation

Presented: 06/16/2011

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

リージョン

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

Column "mime:" Row Key Time Stamp

"com.cnn.www" "text/html"t9

リージョン1

HBaseアーキテクチャ概要

HBaseサーバー構成

データモデル

実装

物理配置

その他

HBaseアーキテクチャ概要 > データモデル > 物理配置

Page 5: 20110616 HBaseアーキテクチャ概要

Presented: 06/16/2011Copyright © 2011 Happy-Camper Street.

Presentation

Presented: 06/16/2011

耐障害性HDFS の NameNode が SPOF

ACID 特性1つの Rowに対するロックを取得できる

- Row内のデータの更新を Atomic に実行することが可能。

- Row内のデータの Consistency は保証される。

- 複数の Rowにまたがる更新の Atomicity は確保できない。

HBaseアーキテクチャ概要

HBaseサーバー構成

データモデル

実装

物理配置

その他

HBaseアーキテクチャ概要 > データモデル > その他

Page 6: 20110616 HBaseアーキテクチャ概要

Presented: 06/16/2011Copyright © 2011 Happy-Camper Street.

Presentation

Presented: 06/16/2011

実装

HMaster

RegionServer RegionServer RegionServer

ZooKeeper クラスタ

HDFS

- リージョン割り当て

- リージョンサーバーの障害回復

- 0 個以上のリージョン

- 読み書き要求

- リージョン分割管理

- クラスタ管理

HBaseアーキテクチャ概要

HBaseサーバー構成

データモデル実装HBase の操作

書き込み

読み込み

その他

HBaseアーキテクチャ概要 > 実装

Page 7: 20110616 HBaseアーキテクチャ概要

Presented: 06/16/2011Copyright © 2011 Happy-Camper Street.

Presentation

Presented: 06/16/2011

HBase の操作 : メタデータ

RegionServer RegionServer RegionServer

ZooKeeper クラスタ

HDFS

1. -ROOT- の位置取得

2. -ROOT- から、.META. の位置取得3. .META. からリージョンの位置取得

クライアント

HBaseアーキテクチャ概要

HBaseサーバー構成

データモデル実装HBase の操作

書き込み

読み込み

その他

HBaseアーキテクチャ概要 > 実装 > HBase の操作

Page 8: 20110616 HBaseアーキテクチャ概要

Presented: 06/16/2011Copyright © 2011 Happy-Camper Street.

Presentation

Presented: 06/16/2011

HBase の操作 : 書き込み

RegionServer RegionServer RegionServer

ZooKeeper クラスタ

HDFS

1. 書き込み

2. コミットログ追記

3. メモリキャッシュに追加

4. メモリキャッシュが一杯になったらフラッシュ

クライアント

HBaseアーキテクチャ概要

HBaseサーバー構成

データモデル実装HBase の操作

書き込み

読み込み

その他

HBaseアーキテクチャ概要 > 実装 > HBase の操作 > 書き込み

Page 9: 20110616 HBaseアーキテクチャ概要

Presented: 06/16/2011Copyright © 2011 Happy-Camper Street.

Presentation

Presented: 06/16/2011

HBase の操作 : 読み込み

RegionServer RegionServer RegionServer

ZooKeeper クラスタ

HDFS

1. 読み込み

2. メモリキャッシュを調べる

3. フラッシュファイルを調べる

クライアント

HBaseアーキテクチャ概要

HBaseサーバー構成

データモデル実装HBase の操作

書き込み

読み込み

その他

HBaseアーキテクチャ概要 > 実装 > HBase の操作 > 読み込み

Page 10: 20110616 HBaseアーキテクチャ概要

Presented: 06/16/2011Copyright © 2011 Happy-Camper Street.

Presentation

Presented: 06/16/2011

Compactions

リージョン分割

minor compaction

major compaction

- フラッシュファイルの数が閾値を超えると1つにまとめる。

- リージョンに属するすべてのフラッシュファイルを定期的に1つにまとめる。

フラッシュファイルのサイズが閾値を超えるとリージョン分割

1. 親リージョンがオフラインに

2. .META. に記録してHMaster に通知

3. HMaster が新規リージョンをアサイン

- この間このリージョンへの読み書きは一時停止

- クライアントは子リージョンがオンラインになるまで待ち。

HBaseアーキテクチャ概要

HBaseサーバー構成

データモデル実装HBase の操作

書き込み

読み込み

その他

HBaseアーキテクチャ概要 > 実装 > その他