2013年7月27日 星期六

[研究] HBase 0.94.10 資料庫 安裝(CentOS 6.4 x86)

[研究] HBase 0.94.10 資料庫 安裝(CentOS 6.4 x86)

Apache HBase is the Hadoop database, a distributed, scalable, big data store.

官方網站
http://hbase.apache.org/

安裝說明
http://hbase.apache.org/book/quickstart.html

安裝(需要自己動下載 Sun Java 1.6 或更新)

chmod +x jdk-6u45-linux-i586-rpm.bin
./jdk-6u45-linux-i586-rpm.bin
export JAVA_HOME=/usr/java/jdk1.6.0_45

wget http://ftp.mirror.tw/pub/apache/hbase/hbase-0.94.10/hbase-0.94.10.tar.gz
tar zxvf hbase-0.94.10.tar.gz -C /usr/local
export HBASE_HOME=/usr/local/hbase-0.94.10

啟動

[root@localhost ~]# /usr/local/hbase-0.94.10//bin/start-hbase.sh
starting master, logging to /usr/local/hbase-0.94.10/bin/../logs/hbase-root-master-localhost.localdomain.out
[root@localhost ~]#

檢查啟動情況

[root@localhost ~]# ps aux | grep hbase
root      3028  0.7  5.6 1235736 116612 pts/1  Sl   20:37   0:03 /usr/java/jdk1.6.0_45//bin/java -XX:OnOutOfMemoryError=kill -9 %p -Xmx1000m -XX:+UseConcMarkSweepGC -Dhbase.log.dir=/usr/local/hbase-0.94.10/bin/../logs -Dhbase.log.file=hbase-root-master-localhost.localdomain.log -Dhbase.home.dir=/usr/local/hbase-0.94.10/bin/.. -Dhbase.id.str=root -Dhbase.root.logger=INFO,DRFA -Djava.library.path=/usr/local/hbase-0.94.10/bin/../lib/native/Linux-i386-32 -Dhbase.security.logger=INFO,DRFAS -classpath /usr/local/hbase-0.94.10/bin/../conf:/usr/java/jdk1.6.0_45//lib/tools.jar:/usr/local/hbase-0.94.10/bin/..:/usr/local/hbase-0.94.10/bin/../hbase-0.94.10.jar:/usr/local/hbase-0.94.10/bin/../hbase-0.94.10-tests.jar:/usr/local/hbase-0.94.10/bin/../lib/activation-1.1.jar:/usr/local/hbase-0.94.10/bin/../lib/asm-3.1.jar:/usr/local/hbase-0.94.10/bin/../lib/avro-1.5.3.jar:/usr/local/hbase-0.94.10/bin/../lib/avro-ipc-1.5.3.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-beanutils-1.7.0.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-beanutils-core-1.8.0.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-cli-1.2.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-codec-1.4.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-collections-3.2.1.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-configuration-1.6.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-digester-1.8.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-el-1.0.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-httpclient-3.1.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-io-2.1.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-lang-2.5.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-logging-1.1.1.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-math-2.1.jar:/usr/local/hbase-0.94.10/bin/../lib/commons-net-1.4.1.jar:/usr/local/hbase-0.94.10/bin/../lib/core-3.1.1.jar:/usr/local/hbase-0.94.10/bin/../lib/guava-11.0.2.jar:/usr/local/hbase-0.94.10/bin/../lib/hadoop-core-1.0.4.jar:/usr/local/hbase-0.94.10/bin/../lib/high-scale-lib-1.1.1.jar:/usr/local/hbase-0.94.10/bin/../lib/httpclient-4.1.2.jar:/usr/local/hbase-0.94.10/bin/../lib/httpcore-4.1.3.jar:/usr/local/hbase-0.94.10/bin/../lib/jackson-core-asl-1.8.8.jar:/usr/local/hbase-0.94.10/bin/../lib/jackson-jaxrs-1.8.8.jar:/usr/local/hbase-0.94.10/bin/../lib/jackson-mapper-asl-1.8.8.jar:/usr/local/hbase-0.94.10/bin/../lib/jackson-xc-1.8.8.jar:/usr/local/hbase-0.94.10/bin/../lib/jamon-runtime-2.3.1.jar:/usr/local/hbase-0.94.10/bin/../lib/jasper-compiler-5.5.23.jar:/usr/local/hbase-0.94.10/bin/../lib/jasper-runtime-5.5.23.jar:/usr/local/hbase-0.94.10/bin/../lib/jaxb-api-2.1.jar:/usr/local/hbase-0.94.10/bin/../lib/jaxb-impl-2.2.3-1.jar:/usr/local/hbase-0.94.10/bin/../lib/jersey-core-1.8.jar:/usr/local/hbase-0.94.10/bin/../lib/jersey-json-1.8.jar:/usr/local/hbase-0.94.10/bin/../lib/jersey-server-1.8.jar:/usr/local/hbase-0.94.10/bin/../lib/jettison-1.1.jar:/usr/local/hbase-0.94.10/bin/../lib/jetty-6.1.26.jar:/usr/local/hbase-0.94.10/bin/../lib/jetty-util-6.1.26.jar:/usr/local/hbase-0.94.10/bin/../lib/jruby-complete-1.6.5.jar:/usr/local/hbase-0.94.10/bin/../lib/jsp-2.1-6.1.14.jar:/usr/local/hbase-0.94.10/bin/../lib/jsp-api-2.1-6.1.14.jar:/usr/local/hbase-0.94.10/bin/../lib/jsr305-1.3.9.jar:/usr/local/hbase-0.94.10/bin/../lib/junit-4.10-HBASE-1.jar:/usr/local/hbase-0.94.10/bin/../lib/libthrift-0.8.0.jar:/usr/local/hbase-0.94.10/bin/../lib/log4j-1.2.16.jar:/usr/local/hbase-0.94.10/bin/../lib/metrics-core-2.1.2.jar:/usr/local/hbase-0.94.10/bin/../lib/netty-3.2.4.Final.jar:/usr/local/hbase-0.94.10/bin/../lib/protobuf-java-2.4.0a.jar:/usr/local/hbase-0.94.10/bin/../lib/servlet-api-2.5-6.1.14.jar:/usr/local/hbase-0.94.10/bin/../lib/slf4j-api-1.4.3.jar:/usr/local/hbase-0.94.10/bin/../lib/slf4j-log4j12-1.4.3.jar:/usr/local/hbase-0.94.10/bin/../lib/snappy-java-1.0.3.2.jar:/usr/local/hbase-0.94.10/bin/../lib/stax-api-1.0.1.jar:/usr/local/hbase-0.94.10/bin/../lib/velocity-1.7.jar:/usr/local/hbase-0.94.10/bin/../lib/xmlenc-0.52.jar:/usr/local/hbase-0.94.10/bin/../lib/zookeeper-3.4.5.jar: org.apache.hadoop.hbase.master.HMaster start
root      3216  0.0  0.0   4356   756 pts/1    S+   20:46   0:00 grep hbase
[root@localhost ~]#

進入管理模式

[root@localhost ~]#  ${HBASE_HOME}/bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.94.10, r1504995, Fri Jul 19 20:24:16 UTC 2013

hbase(main):001:0>

help說明

hbase(main):001:0> help
HBase Shell, version 0.94.10, r1504995, Fri Jul 19 20:24:16 UTC 2013
Type 'help "COMMAND"', (e.g. 'help "get"' -- the quotes are necessary) for help on a specific command.
Commands are grouped. Type 'help "COMMAND_GROUP"', (e.g. 'help "general"') for help on a command group.

COMMAND GROUPS:
  Group name: general
  Commands: status, version, whoami

  Group name: ddl
  Commands: alter, alter_async, alter_status, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, is_disabled, is_enabled, list, show_filters

  Group name: dml
  Commands: count, delete, deleteall, get, get_counter, incr, put, scan, truncate

  Group name: tools
  Commands: assign, balance_switch, balancer, close_region, compact, flush, hlog_roll, major_compact, move, split, unassign, zk_dump

  Group name: replication
  Commands: add_peer, disable_peer, enable_peer, list_peers, remove_peer, start_replication, stop_replication

  Group name: snapshot
  Commands: clone_snapshot, delete_snapshot, list_snapshots, restore_snapshot, snapshot

  Group name: security
  Commands: grant, revoke, user_permission

SHELL USAGE:
Quote all names in HBase Shell such as table and column names.  Commas delimit
command parameters.  Type <RETURN> after entering a command to run it.
Dictionaries of configuration used in the creation and alteration of tables are
Ruby Hashes. They look like this:

  {'key1' => 'value1', 'key2' => 'value2', ...}

and are opened and closed with curley-braces.  Key/values are delimited by the
'=>' character combination.  Usually keys are predefined constants such as
NAME, VERSIONS, COMPRESSION, etc.  Constants do not need to be quoted.  Type
'Object.constants' to see a (messy) list of all constants in the environment.

If you are using binary keys or values and need to enter them in the shell, use
double-quote'd hexadecimal representation. For example:

  hbase> get 't1', "key\x03\x3f\xcd"
  hbase> get 't1', "key\003\023\011"
  hbase> put 't1', "test\xef\xff", 'f1:', "\x01\x33\x40"

The HBase shell is the (J)Ruby IRB with the above HBase-specific commands added.
For more on the HBase Shell, see http://hbase.apache.org/docs/current/book.html
hbase(main):002:0>

建立稱為 mytable 的資料表,和稱為 mycolumnfamily 的 column family。

hbase(main):003:0* create "mytable", "mycolumnfamily"
0 row(s) in 1.3820 seconds

檢視 mytable 資訊

hbase(main):004:0> describe "mytable"
DESCRIPTION                                                             ENABLED
 {NAME => 'mytable', FAMILIES => [{NAME => 'mycolumnfamily', COMPRESSIO true
 N => 'NONE', VERSIONS => '3', TTL => '2147483647', BLOCKSIZE => '65536
 ', IN_MEMORY => 'false', BLOCKCACHE => 'true'}]}
1 row(s) in 0.0640 seconds

增加一列 myrow 到 "mycolumnfamily:x" 行,值為 v

hbase(main):005:0> put "mytable", "myrow", "mycolumnfamily:x", "v"
0 row(s) in 0.0530 seconds

顯示值

hbase(main):006:0> get "mytable", "myrow"
COLUMN                                        CELL
 mycolumnfamily:x                             timestamp=1374929517279, value=v
1 row(s) in 0.0200 seconds

掃描 mytable

hbase(main):007:0> scan "mytable"
ROW                                           COLUMN+CELL
 myrow                                        column=mycolumnfamily:x, timestamp=1374929282679, value=v
1 row(s) in 0.0270 seconds

離開交談模式

hbase(main):006:0> quit

停止 hbase

[root@localhost ~]# /usr/local/hbase-0.94.10//bin/stop-hbase.sh
stopping hbase.............

(完)

[研究] HBase 0.94.10 資料庫 安裝(CentOS 6.4 x64)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=80022

沒有留言:

張貼留言