Seven Databases in Seven Weeks HBase. HDFS (Hadoop Distributed File System) Server DFS HBase.

Slides:



Advertisements
Similar presentations
Seven Databases in Seven Weeks HBase ふつかめ. Hbase とは何か Google File Sytem (GFS) MapReduceBigTable Google の 内部システム (発表した論文より) Hadoop Distributed File Sytem.
Advertisements

だい六か – クリスマスとお正月 ぶんぽう. て form review ► Group 1 Verbs ► Have two or more ひらがな in the verb stem AND ► The final sound of the verb stem is from the い row.
て -form - Making て -form from ます -form -. With て -form, You can say... ~てもいいですか? (= May I do…) ~てください。 (= Please do…) ~ています。 (= am/is/are doing…) Connecting.
第 5 章 2 次元モデル Chapter 5 2-dimensional model. Contents 1.2 次元モデル 2-dimensional model 2. 弱形式 Weak form 3.FEM 近似 FEM approximation 4. まとめ Summary.
この部分こそが必 要とされている ! Runtime 自身と Expression が カバーする!
Essay writing rules for Japanese!!. * First ・ There are two directions you can write. ・よこがき / 横書き (same as we write English) ・たてがき / 縦書き (from right to.
VE 01 え form What is え form? え? You can do that many things with え form?
ネットワークからみるPCC 寺内康之.
BBT大学 Ruby on Rails開発環境セットアップマニュアル
SS2-15:A Study on Image Recognition and Understanding
SQLite3
CCP Express 3.1 リカバリ&初期化ガイド
2006年11月15日 植田龍男 Webサービス II (第8回) 年11月15日 植田龍男.
3-1 MySQLについて 発表者:藤村元彦 自然言語処理研究室.
The Bar バー.
英語勉強会.
第1回レポートの課題 6月15日出題 今回の課題は1問のみ 第2回レポートと併せて本科目の単位を認定 第2回は7月に出題予定
日本語... ジェパディー! This is a template for you to use in your classroom.
Ex8. Search for Vacuum Problem(2)
2009年 3月 17日 法政大学 常盤祐司、児玉靖司、八名和夫、Ivan Ho、Billy Pham
Chris Burgess (1号館1308研究室、内線164)
じょし Particles.
What did you do, mate? Plain-Past
Tohoku University Kyo Tsukada
WSDL と JAX-RPC 年10月20日 Webサービス II (第4回) WSDL と JAX-RPC 年10月20日.
十年生の 日本語 Year 10 Writing Portfolio
Licensing information
Chapter 4 Quiz #2 Verbs Particles を、に、で
The Sacred Deer of 奈良(なら)
“You Should Go To Kyoto”
スクリプト言語を用いたPHITSの連続実行
.NET テクノロジー を利用した SAP ソリューションの拡張 (3階層化) (評価環境構築ガイド)
Nihongo Japanese 日本ご ‘Numbers ’ & ‘Hiragana Revision’
ストップウォッチの カード ストップウォッチの カード
Cisco Catalyst 2960L Loop Detection のご紹介 2018 年 1 月.
九州大学キャンパスクラウド 利用法 情報ネットワーク特論 講義資料.
第12回 2007年7月13日 応用Java (Java/XML).
New accessory hardware Global Platform Division
第2回.リレーショナルデータベース入門 SQL を用いたテーブルへの行の挿入 SQL 問い合わせの発行と評価結果の確認.
3-10. MySQLシステムの管理  2004年6月10日  大北高広                01T6010F.
第1回.リレーショナルデータベースを使ってみよう
第2回.リレーショナルデータベース入門 SQL を用いたテーブルへの行の挿入 SQL 問い合わせの発行と評価結果の確認.
SQL パフォーマンス チューニング ~ プランガイドの利用~
Causative Verbs Extensively borrowed from Rubin, J “Gone Fishin’”, Power Japanese (1992: Kodansha:Tokyo) Created by K McMahon.
わんくま同盟・techbank.jp 夏椰 Insight Technology, Inc. 今川 美保
Windows PowerShell Cmdlet
WLTC Mode Construction
-Get test signed and make corrections
にほんご JPN101 Oct. 5, 2009 (Monday).
Term paper, Report (1st, first)
情報源:MARA/ARMA 加 工:成田空港検疫所 菊池
WELCOME TO THE WORLD OF DRAGON BALL
Where is Wumpus Propositional logic (cont…) Reasoning where is wumpus
大規模なこと Large scale.
いくらですか?.
Term paper, report (2nd, final)
情報工学科 3年生対象 専門科目 システムプログラミング 第4回 シェルスクリプト 情報工学科 篠埜 功.
第1回レポートの課題 6月24日出題 今回の課題は1問のみ 第2回レポートと併せて本科目の単位を認定 第2回は7月に出題予定
Genetic Statistics Lectures (4) Evaluation of a region with SNPs
千代浩司 高エネルギー加速器研究機構 素粒子原子核研究所
千代浩司 高エネルギー加速器研究機構 素粒子原子核研究所
Created by L. Whittingham
Db2 Warehouse on Cloud Db2 on Cloud フルマネージドサービス提案時の注意点
Visualizing Japanese Grammar Appendix
Grammar Point 2: Describing the locations of objects
Term paper, report (2nd, final)
09 06/23 PHP と SQL (MySQL) の連携 その3
第2回.リレーショナルデータベース入門 SQL を用いたテーブルへの行の挿入 SQL 問い合わせの発行と評価結果の確認.
Improving Strategic Play in Shogi by Using Move Sequence Trees
千代浩司 高エネルギー加速器研究機構 素粒子原子核研究所
Presentation transcript:

Seven Databases in Seven Weeks HBase

HDFS (Hadoop Distributed File System) Server DFS HBase

7 つのデータベース7つの世界 での構成 1日目: CRUD とテーブル管理 2日目:ビッグデータを扱う 3日目:クラウドに持っていく スタンドアロンで Hbase を動かす テーブルを作る データの出し入れをする Wikipedia ダンプを投入する スクリプト (Not Shell) での操作に慣れる Thrift を使って操作する Whirr を使って EC2 にデプロイする 今回は扱いません

HBase の特徴 自動シャーディング・自動フェールオーバー データの一貫性 (CAP:Consistency) Hadoop/HDFS 統合 各種インタフェース テーブルサイズが大きくなった時、自動的に分割する 分割されたシャードは、ノード障害時に自動的にフェールオーバーする データの更新は反映された瞬間から読出可能 結果的に同じ値が読めるようになる(結果整合性)条件緩和を取らない Hadoop の HDFS 上 に展開できる Hadoop/MapReduce で API を挟まず HBase を入出力の対象にできる Java Native API の他、 Thrift, REST API から利用可能

1日目: HBase をスタンドアロンで展開する ask]# cd /opt/ opt]# wget opt]# tar zxvf hbase tar.gz opt]# vi hbase /conf/hbase-site.xml hbase.rootdir file:///var/files/hbase hbase.zookeeper.property.dataDir /var/files/zookeeper 実行コマンド hbase-site.xml /var /files /hbase /zookeeper ファイル実体配置 単体で可動するための最小限の設定 ファイル設置先の指定で、任意のディレクトリを書き出し先に指定する xml で指定できる全項目 : src/main/resources/hbase-default.xml

1日目: HBase をスタンドアロンで展開する opt]# hbase /bin/start-hbase.sh +======================================================================+ | Error: JAVA_HOME is not set and Java could not be found | | Please download the latest Sun JDK from the Sun Java web site | | > < | | | HBase requires Java 1.6 or later. | | NOTE: This script will find Sun Java whether you install using the | | binary or the RPM based installer. | +======================================================================+ JDK が要求される opt]# vi hbase /conf/hbase-env.sh - # export JAVA_HOME=/usr/java/jdk1.6.0/ + export JAVA_HOME=/usr/java/latest/ JDK のバリエーション(以下から選んで導入) Oracle JDKOpen JDK Java のインストールディレクトリを指定

1日目: HBase をスタンドアロンで展開する opt]# hbase /bin/start-hbase.sh starting master, logging to /opt/hbase /bin/../logs/hbase-root-master-HBase01.db.algnantoka.out opt]# hbase /bin/stop-hbase.sh stopping hbase 起動 停止 opt]# hbase /bin/hbase shell HBase Shell; enter 'help ' for list of supported commands. Type "exit " to leave the HBase Shell Version , r , Wed Apr 24 18:48:26 PDT 2013 hbase(main):001:0> status 1 servers, 0 dead, average load シェル接続

1日目: HBase の使い方 hbase(main):009:0> help "create" Create table; pass table name, a dictionary of specifications per column family, and optionally a dictionary of table configuration. Dictionaries are described below in the GENERAL NOTES section. Examples: hbase> create 't1', {NAME => 'f1', VERSIONS => 5} hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'} hbase> # The above in shorthand would be the following: hbase> create 't1', 'f1', 'f2', 'f3‘ hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => , BLOCKCACHE => true} hbase> create 't1', 'f1', {SPLITS => ['10', '20', '30', '40']} hbase> create 't1', 'f1', {SPLITS_FILE => 'splits.txt'} hbase> # Optionally pre-split the table into NUMREGIONS, using hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname) hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'} テーブル作成 : create Create ‘TableName’, {NAME => ‘ColumnFamilyName’, Option => Value …} … 基本型 省略表記 Create ‘TableName’, ‘ColumnFamilyName’, …

1日目: HBase の使い方 hbase(main):010:0> help "put" Put a cell 'value' at specified table/row/column and optionally timestamp coordinates. To put a cell value into table 't1' at row 'r1' under column 'c1' marked with the time 'ts1', do: hbase> put 't1', 'r1', 'c1', 'value', ts1 レコード挿入 : put SampleTable : create ‘SampleTable’, ‘color’, ‘shape’ put ‘SampleTable’, ‘first’, ‘color:red’, ‘#F00’ put ‘SampleTable’, ‘first’, ‘color:blue’, ‘#00F’ put ‘SampleTable’, ‘first’, ‘color:yellow’, ‘#FF0’

1日目: HBase の使い方 hbase(main):011:0> help "get" Get row or cell contents; pass table name, row, and optionally a dictionary of column(s), timestamp, timerange and versions. Examples: hbase> get 't1', 'r1‘ hbase> get 't1', 'r1', {TIMERANGE => [ts1, ts2]} hbase> get 't1', 'r1', {COLUMN => 'c1'} hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4} hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4} hbase> get 't1', 'r1', {FILTER => "ValueFilter(=, 'binary:abc')"} hbase> get 't1', 'r1', 'c1‘ hbase> get 't1', 'r1', 'c1', 'c2‘ hbase> get 't1', 'r1', ['c1', 'c2'] レコード取得 : get get ‘SampleTable’, ‘first’ SampleTable get ‘SampleTable’, ‘first’, ‘color’ get ‘SampleTable’, ‘first’, ‘color:blue’

1日目: HBase の使い方 hbase(main):001:0> help 'scan' Scan a table; pass table name and optionally a dictionary of scanner specifications. Scanner specifications may include one or more of: TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, TIMESTAMP, MAXLENGTH, or COLUMNS, CACHE If no columns are specified, all columns will be scanned. To scan all members of a column family, leave the qualifier empty as in 'col_family:'. The filter can be specified in two ways: 1. Using a filterString - more information on this is available in the Filter Language document attached to the HBASE-4176 JIRA 2. Using the entire package name of the filter. Some examples: hbase> scan '.META.' hbase> scan '.META.', {COLUMNS => 'info:regioninfo'} hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'} hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [ , ]} hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND (QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"} hbase> scan 't1', {FILTER => org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(1, 0)} For experts, there is an additional option -- CACHE_BLOCKS -- which switches block caching for the scanner on (true) or off (false). By default it is enabled. Examples: hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false} Also for experts, there is an advanced option -- RAW -- which instructs the scanner to return all cells (including delete markers and uncollected deleted cells). This option cannot be combined with requesting specific COLUMNS. Disabled by default. Example: hbase> scan 't1', {RAW => true, VERSIONS => 10} レコード検索 : scan

1日目: HBase の使い方 TimeStamp #FFF ‘first’, ‘color:red’ #000 #0F0 #00F #F00 put ‘table’, ‘first’, ‘color:red’, ‘#FFF‘ put ‘table’, ‘first’, ‘color:red’, ‘#000' put ‘table’, ‘first’, ‘color:red’, ‘#0F0‘ put ‘table’, ‘first’, ‘color:red’, ‘#00F' put ‘table’, ‘first’, ‘color:red’, ‘#F00' timestamp 1 timestamp 2 timestamp 3 timestamp 4 timestamp 5 get ‘table’, ‘first’, ‘color:red’ get ‘table’, ‘first’, {COLUMN=>‘color:red’, TIMESTAMP=>4} get ‘table’, ‘first’, {COLUMN=>‘color:red’, VERSIONS=>4}

1日目: HBase の使い方 スキーマ変更 : alter hbase(main):009:0> disable 'table1' 0 row(s) in seconds hbase(main):010:0> get 'table1', 'first','color:red' COLUMN CELL ERROR: org.apache.hadoop.hbase.DoNotRetryIOException: table1 is disabled. hbase(main):012:0> alter 'table1', { NAME => 'color', VERSIONS => 10} Updating all regions with the new schema... 1/1 regions updated. Done. 0 row(s) in seconds hbase(main):014:0> enable 'table1' 0 row(s) in seconds alter の対象 Table は オフラインでなければ ならない 保持するバージョン数の変更 alter によるスキーマ変更の手順は以下 1. 新たなスキーマの空テーブルを作る 2. 元テーブルからデータを複製する 3. 元テーブルを破棄する 高コストなので、原則スキーマ変更( ColumnFamily の変更)は行わない

1日目: HBase の使い方 JRuby スクリプティング include Java import org.apache.hadoop.hbase.client.HTable import org.apache.hadoop.hbase.client.Put import org.apache.hadoop.hbase.HBaseConfiguration def jbytes(*args) args.map { |arg| arg.to_s.to_java_bytes } end table = HTable.new( HBaseConfiguration.new, "table1" ) p = Put.new( *jbytes( "third" ) ) p.add( *jbytes( "color", "black", "#000" ) ) p.add( *jbytes( "shape", "triangle", "3" ) ) p.add( *jbytes( "shape", "square", "4" ) ) table.put( p ) hoge.rb opt]# hbase /bin/hbase shell hoge.rb hbase(main):002:0> get 'table1', 'third',{COLUMN => ['color','shape']} COLUMN CELL color:black timestamp= , value=#000 shape:square timestamp= , value=4 shape:triangle timestamp= , value=3 9 row(s) in seconds 実行 レコード挿入タイミング レコードの timestamp が揃う hbase shell は JRuby インタプリタを拡張したものなので、 JRuby が実行できる hbase 関係の Java クラス

Hbase とは何か Google File Sytem (GFS) MapReduceBigTable Google の 内部システム (発表した論文より) Hadoop Distributed File Sytem (HDFS) MapReduceHBase Hadoop プロジェクト ( Google クローン) バッチ処理リアルタイム応答

RowKeyColumnFamily1ColumnFamily2ColumnFamily3 1Column1Column2Column1Column2Column1 2Column2Column3Column2Column3 BigTable( ソート済列志向データベース ) スキーマで定義する スキーマレス(自由に追加できる) 必須 ソート済 #FFF ある Column #000 #0F0 #00F #F00 timestamp 1 timestamp 2 timestamp 3 timestamp 4 timestamp 5 タイムスタンプでバージョニングされる

RowKeyColumnFamily1ColumnFamily2ColumnFamily リージョン BigTable( ソート済列志向データベース ) リージョン テーブルはリージョンで物理的に分割(シャーディング)される リージョンはクラスタ中のリージョンサーバが担当する リージョンは ColumnFamily 毎に作られる リージョンは ソート済の RowKey を適当なサイズで分割する

BigTable( ソート済列志向データベース ) ColumnFamily はむやみに増やさない → Column の追加で極力対応 RowKey は連続アクセスが起きやすい形にしておく テーブルはリージョンで物理的に分割(シャーディング)される リージョンはクラスタ中のリージョンサーバが担当する リージョンは ColumnFamily 毎に作られる リージョンは ソート済の RowKey を適当なサイズで分割する Column や ColumnFamily を条件にして検索する構造を取らない テーブルスキーマの初期設計超重要

HBase の特徴 自動シャーディング・自動フェールオーバー データの一貫性 (CAP:Consistency) Hadoop/HDFS 統合 テーブルサイズが大きくなった時、自動的に分割する 分割されたシャードは、ノード障害時に自動的にフェールオーバーする データの更新は反映された瞬間から読出可能 結果的に同じ値が読めるようになる(結果整合性)条件緩和を取らない Hadoop の HDFS 上 に展開できる Hadoop/MapReduce で API を挟まず HBase を入出力の対象にできる

HBase の特徴 を構成する要素 自動シャーディング・自動フェールオーバー データの一貫性 (CAP:Consistency) Hadoop/HDFS 統合 リージョンの自動分割?? HDFS : GFS クローン Hbase : BigTable クローン

HDFS HBase の特徴 を構成する要素 自動フェールオーバー・データの一貫性 (CAP:Consistency) Master Server ZooKeeper Region Server ( フェールオーバー先 ) ローカルストア RegionWAL オンメモリ ストア Read Write ローカルストア RegionWAL replicate

2日目: Wikipedia のデータを扱う 力尽きた\ ( ^ 0 ^ ) /

Scan にかかる秒数