20110616 hbase勉強会(第二回)

Post on 15-Jan-2015

783 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

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!!@ueshinueshin@happy-camper.sthttp://happy-camper.st/

tall table vs wide table

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!!

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!!

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

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!!

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!!

・・・

・・・

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” 以外を捨てる

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!!

・・・

・・・

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!!

・・・

・・・

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: 不要

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!!

・・・

・・・

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 の危険性

top related