Changes between Initial Version and Version 1 of HBase


Ignore:
Timestamp:
May 5, 2008, 2:17:10 PM (16 years ago)
Author:
chwhs
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HBase

    v1 v1  
     1
     2== '''''HBase''''' ==
     3
     4 * How to download and run HBase? in about 10 Minutes.
     5  * 以下有幾個簡單的步驟:(包含了下載.安裝及配置HBase)
     6    * 首先需要先下載HBase最新且穩定的版本[http://www.apache.org/dyn/closer.cgi/hadoop/hbase/ Download]
     7    * 接著將下載的檔案移到你想要跑HBase的目錄下,如/home/user/hbase
     8    * 移動到/home/user/hbase此目錄下
     9{{{
     10$ cd /home/user/hbase
     11}}}
     12    * 編輯conf/hbase-env.sh檔案,加入以下這行 (需視使用者的JAVA路徑而定)
     13{{{
     14$ vi conf/hbase-env.sh
     15  export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.03
     16}}}
     17    * 啟動hbase
     18{{{
     19$ bin/start-hbase.sh
     20}}}   
     21    * 可以在預設的logs/目錄下看到不少logs檔案
     22    * 可以執行以下指令進到HQL指令模式,可以試試看
     23{{{
     24$ bin/hbase shell
     25Hbase Shell, 0.0.2 version.
     26Copyright (c) 2007 by udanax, licensed to Apache Software Foundation.
     27Type 'help;' for usage.
     28
     29hql > help;
     30Type 'help COMMAND;' to see command-specific usage.
     31+-------------------------+-------------------------+-------------------------+
     32| Command                 | Description             | Example                 |
     33+-------------------------+-------------------------+-------------------------+
     34| EXIT                    | Exit shell              | EXIT;                   |
     35+-------------------------+-------------------------+-------------------------+
     36| ALTER                   | Alter structure of table| ALTER TABLE table_name A|
     37|                         |                         | DD column_spec | ADD (co|
     38|                         |                         | lumn_spec, column_spec, |
     39|                         |                         | ...) | CHANGE column_fam|
     40|                         |                         | ily column_spec | DROP c|
     41|                         |                         | olumn_family_name | CHAN|
     42|                         |                         | GE column_spec;         |
     43+-------------------------+-------------------------+-------------------------+
     44| CREATE                  | Create tables           | CREATE TABLE table_name |
     45|                         |                         | (column_family_name [MAX|
     46|                         |                         | _VERSIONS=n] [MAX_LENGTH|
     47|                         |                         | =n] [COMPRESSION=NONE|RE|
     48|                         |                         | CORD|BLOCK] [IN_MEMORY] |
     49|                         |                         | [BLOOMFILTER=NONE|BLOOMF|
     50|                         |                         | ILTER|COUNTING_BLOOMFILT|
     51|                         |                         | ER|RETOUCHED_BLOOMFILTER|
     52|                         |                         |  VECTOR_SIZE=n NUM_HASH=|
     53|                         |                         | n], ...)                |
     54+-------------------------+-------------------------+-------------------------+
     55| INSERT                  | Insert values into table| INSERT INTO table_name (|
     56|                         |                         | column_name, ...) VALUES|
     57|                         |                         |  ('value', ...) WHERE ro|
     58|                         |                         | w='row_key' [TIMESTAMP '|
     59|                         |                         | timestamp'];            |
     60+-------------------------+-------------------------+-------------------------+
     61| DROP                    | Drop tables             | DROP TABLE table_name [,|
     62|                         |                         |  table_name] ...;       |
     63+-------------------------+-------------------------+-------------------------+
     64| TRUNCATE                | Truncate table is used t| TRUNCATE TABLE table_nam|
     65|                         | o clean all data from a | e;                      |
     66|                         | table                   |                         |
     67+-------------------------+-------------------------+-------------------------+
     68| DESCRIBE                | Print table information | [DESCRIBE|DESC] table_na|
     69|                         |                         | me;                     |
     70+-------------------------+-------------------------+-------------------------+
     71| JAR                     | Hadoop RunJar util      | JAR jarFile [mainClass] |
     72|                         |                         | arguments...;           |
     73+-------------------------+-------------------------+-------------------------+
     74| FS                      | Hadoop FsShell; entering| FS [-option] arguments..|
     75|                         |  a lone 'FS;' will emit | ;                       |
     76|                         | usage                   |                         |
     77+-------------------------+-------------------------+-------------------------+
     78| DELETE                  | Delete table data       | DELETE {column_name, [, |
     79|                         |                         | column_name] ... | *} FR|
     80|                         |                         | OM table_name WHERE row=|
     81|                         |                         | 'row-key';              |
     82+-------------------------+-------------------------+-------------------------+
     83| SELECT                  | Select values from table| SELECT {column_name, [, |
     84|                         |                         | column_name] ... | expr[|
     85|                         |                         | alias] | * } FROM table_|
     86|                         |                         | name [WHERE row='row_key|
     87|                         |                         | ' | STARTING FROM 'row-k|
     88|                         |                         | ey' [UNTIL 'stop-key']] |
     89|                         |                         | [NUM_VERSIONS = version_|
     90|                         |                         | count] [TIMESTAMP 'times|
     91|                         |                         | tamp'] [LIMIT = row_coun|
     92|                         |                         | t] [INTO FILE 'file_name|
     93|                         |                         | '];                     |
     94+-------------------------+-------------------------+-------------------------+
     95| SHOW                    | Show information about s| SHOW TABLES [or substitu|
     96|                         | elected title           | tion variable name];    |
     97+-------------------------+-------------------------+-------------------------+
     98| CLEAR                   | Clear the screen        | CLEAR;                  |
     99+-------------------------+-------------------------+-------------------------+
     100hql > help;
     101Type 'help COMMAND;' to see command-specific usage.
     102+-------------------------+-------------------------+-------------------------+
     103| Command                 | Description             | Example                 |
     104+-------------------------+-------------------------+-------------------------+
     105| EXIT                    | Exit shell              | EXIT;                   |
     106+-------------------------+-------------------------+-------------------------+
     107| ALTER                   | Alter structure of table| ALTER TABLE table_name A|
     108|                         |                         | DD column_spec | ADD (co|
     109|                         |                         | lumn_spec, column_spec, |
     110|                         |                         | ...) | CHANGE column_fam|
     111|                         |                         | ily column_spec | DROP c|
     112|                         |                         | olumn_family_name | CHAN|
     113|                         |                         | GE column_spec;         |
     114+-------------------------+-------------------------+-------------------------+
     115| CREATE                  | Create tables           | CREATE TABLE table_name |
     116|                         |                         | (column_family_name [MAX|
     117|                         |                         | _VERSIONS=n] [MAX_LENGTH|
     118|                         |                         | =n] [COMPRESSION=NONE|RE|
     119|                         |                         | CORD|BLOCK] [IN_MEMORY] |
     120|                         |                         | [BLOOMFILTER=NONE|BLOOMF|
     121|                         |                         | ILTER|COUNTING_BLOOMFILT|
     122|                         |                         | ER|RETOUCHED_BLOOMFILTER|
     123|                         |                         |  VECTOR_SIZE=n NUM_HASH=|
     124|                         |                         | n], ...)                |
     125+-------------------------+-------------------------+-------------------------+
     126| INSERT                  | Insert values into table| INSERT INTO table_name (|
     127|                         |                         | column_name, ...) VALUES|
     128|                         |                         |  ('value', ...) WHERE ro|
     129|                         |                         | w='row_key' [TIMESTAMP '|
     130|                         |                         | timestamp'];            |
     131+-------------------------+-------------------------+-------------------------+
     132| DROP                    | Drop tables             | DROP TABLE table_name [,|
     133|                         |                         |  table_name] ...;       |
     134+-------------------------+-------------------------+-------------------------+
     135| TRUNCATE                | Truncate table is used t| TRUNCATE TABLE table_nam|
     136|                         | o clean all data from a | e;                      |
     137|                         | table                   |                         |
     138+-------------------------+-------------------------+-------------------------+
     139| DESCRIBE                | Print table information | [DESCRIBE|DESC] table_na|
     140|                         |                         | me;                     |
     141+-------------------------+-------------------------+-------------------------+
     142| JAR                     | Hadoop RunJar util      | JAR jarFile [mainClass] |
     143|                         |                         | arguments...;           |
     144+-------------------------+-------------------------+-------------------------+
     145| FS                      | Hadoop FsShell; entering| FS [-option] arguments..|
     146|                         |  a lone 'FS;' will emit | ;                       |
     147|                         | usage                   |                         |
     148+-------------------------+-------------------------+-------------------------+
     149| DELETE                  | Delete table data       | DELETE {column_name, [, |
     150|                         |                         | column_name] ... | *} FR|
     151|                         |                         | OM table_name WHERE row=|
     152|                         |                         | 'row-key';              |
     153+-------------------------+-------------------------+-------------------------+
     154| SELECT                  | Select values from table| SELECT {column_name, [, |
     155|                         |                         | column_name] ... | expr[|
     156|                         |                         | alias] | * } FROM table_|
     157|                         |                         | name [WHERE row='row_key|
     158|                         |                         | ' | STARTING FROM 'row-k|
     159|                         |                         | ey' [UNTIL 'stop-key']] |
     160|                         |                         | [NUM_VERSIONS = version_|
     161|                         |                         | count] [TIMESTAMP 'times|
     162|                         |                         | tamp'] [LIMIT = row_coun|
     163|                         |                         | t] [INTO FILE 'file_name|
     164|                         |                         | '];                     |
     165+-------------------------+-------------------------+-------------------------+
     166| SHOW                    | Show information about s| SHOW TABLES [or substitu|
     167|                         | elected title           | tion variable name];    |
     168+-------------------------+-------------------------+-------------------------+
     169| CLEAR                   | Clear the screen        | CLEAR;                  |
     170+-------------------------+-------------------------+-------------------------+
     171hql >
     172}}}
     173    * 要結束hbase server 可用以下指令,而避免使用kill指令來殺掉pid
     174{{{
     175$ bin/stop-hbase.sh
     176}}}
     177    * 注意:如果有要跑一個遠端的HDFS,而希望可以用hbase連接,此時需要編輯conf/hbase-site.xml檔案,如下
     178{{{
     179$ vi conf/hbase-site.xml
     180<configuration>
     181  <property>
     182     <name>hbase.rootdir</name>
     183     <value>file:///tmp/hbase-${user.home}/hbase</value>
     184     <value>hdfs://localhost:9000/hbase</value>
     185     <description>
     186         The directory shared by region servers.
     187         Should be fully-qualified to include the filesystem to use.
     188     </description>
     189  </property>
     190</configuration>
     191}}}