20110616 hbase勉強会(第二回)

12
Copyright (c) 2011 Happy-Camper Street. All Rights Reserved. Presented: 2011-06-16 HBase 勉強会 ( 第二回 ) ‥> tall table vs wide table tall table wide table Scan? MapReduce? まとめ tall table vs wide table user status name created_at text created_at source user1-status1 user1-status2 ・・・ row key {user_id}-{status_id} ueshin ueshin HBase! HBase! HBase!! tall table wide table user status name created_at status1 status2 ・・・ user1 user2 ・・・ row key {user_id} ueshin takuya HBase! HBase! HBase!! @ueshin [email protected] http://happy-camper.st/ tall table vs wide table

Upload: takuya-ueshin

Post on 15-Jan-2015

783 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

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

tall table vs wide table

Page 2: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

Page 3: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

Page 4: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

user

namecreated_atuser1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

namecreated_at

ueshin

status

sourcecreated_at

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

HBase!text

sourcecreated_at

HBase! HBase!!text

user

namecreated_atuser1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

namecreated_at

ueshin

status

sourcecreated_at

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

HBase!text

sourcecreated_at

HBase! HBase!!text

Page 5: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

Page 6: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

user

namecreated_atuser1

user2

・・・

row key{user_id}

ueshin

namecreated_at

takuya

status

status2status1

user1

user2

row key{user_id}

HBase!HBase! HBase!!

・・・

・・・

user

namecreated_atuser1

user2

・・・

row key{user_id}

ueshin

namecreated_at

takuya

status

status2status1

user1

user2

row key{user_id}

HBase!HBase! HBase!!

・・・

・・・

Page 7: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

Scan?

・あるユーザーのステータスを取得

  “user1” を Prefix にした RangeScan

・あるユーザーのステータスを 1 個取得

  “user1-status1” で Get

・あるユーザーのステータスを取得

  “user1” で Get

・あるユーザーのステータスを 1 個取得

  “user1” で Get したあと、 “status1” 以外を捨てる

Page 8: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

Scan?

・あるユーザーのステータスを取得

  “user1” を Prefix にした RangeScan

・あるユーザーのステータスを取得

  “user1” で Get

status

sourcecreated_at

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

HBase!text

sourcecreated_at

HBase! HBase!!text・あるユーザーのステータスを 1 個取得

  “user1-status1” で Get

・あるユーザーのステータスを 1 個取得

  “user1” で Get したあと、 “status1” 以外を捨てる

status

status2status1

user1

user2

row key{user_id}

HBase!HBase! HBase!!

・・・

・・・

Page 9: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

Scan?

・あるユーザーのステータスを取得

  “user1” を Prefix にした RangeScan

・あるユーザーのステータスを取得

  “user1” で Get

status

sourcecreated_at

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

HBase!text

sourcecreated_at

HBase! HBase!!text・あるユーザーのステータスを 1 個取得

  “user1-status1” で Get

・あるユーザーのステータスを 1 個取得

  “user1” で Get したあと、 “status1” 以外を捨てる

status

status2status1

user1

user2

row key{user_id}

HBase!HBase! HBase!!

・・・

・・・

Page 10: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

MapReduce?

入力毎に、 K => V の形式

入力毎に、 K => List<V> の形式 (Reduce 風の入力 )

・ワードカウント

  ツイート毎に「単語 => 数」を出力

・ユーザー毎のツイート数をカウント

  map: “user1” => 1

  reduce: “user1” => sum

・ワードカウント

  ユーザー毎に「単語 => 数」を出力

・ユーザー毎のツイート数をカウント

  map: “user1” => status の数

  reduce: 不要

Page 11: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

MapReduce?

入力毎に、 K => V の形式

入力毎に、 K => List<V> の形式 (Reduce 風の入力 )

・ワードカウント

  ツイート毎に「単語 => 数」を出力

・ユーザー毎のツイート数をカウント

  map: “user1” => 1

  reduce: “user1” => sum

・ワードカウント

  ユーザー毎に「単語 => 数」を出力

・ユーザー毎のツイート数をカウント

  map: “user1” => status の数

  reduce: 不要

status

sourcecreated_at

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

HBase!text

sourcecreated_at

HBase! HBase!!text

status

status2status1

user1

user2

row key{user_id}

HBase!HBase! HBase!!

・・・

・・・

Page 12: 20110616 HBase勉強会(第二回)

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

Presented: 2011-06-16

HBase 勉強会 ( 第二回 )‥>

tall table vs wide table tall table wide tableScan?MapReduce?まとめ

tall table vs wide table

user statusname created_at text created_at source

user1-status1

user1-status2

・・・

row key{user_id}-{status_id}

ueshin

ueshin

HBase!

HBase! HBase!!

tall table

wide table

user statusname created_at status1 status2 ・・・

user1

user2

・・・

row key{user_id}

ueshin

takuya

HBase! HBase! HBase!!

利点・キーの分散が容易(データの偏りは別問題ですが)

・MapReduce の分岐、合流地点に

欠点・リージョンの肥大化

・OOME の危険性