2014年8月13日 星期三

[研究] HBase 0.98.5 資料庫 安裝(CentOS 7.0 x86_64)

[研究] HBase 0.98.5 資料庫 安裝(CentOS 7.0 x86_64)

2014-08-13

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

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

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

安裝 (需要 Java )

yum  -y  install  java
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64/jre
echo 'export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64/jre' >> /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> /etc/profile
echo 'export CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar' >> /etc/profile
source /etc/profile
java -version

JAVA_HOME 路徑選擇可參考選結尾  /bin/java 的
[root@localhost ~]# find / -name java
find: ‘/run/user/1000/gvfs’: Permission denied
/etc/pki/ca-trust/extracted/java
/etc/pki/java
/etc/java
/etc/alternatives/java
/var/lib/alternatives/java
/usr/bin/java
/usr/lib/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64/jre/bin/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64/jre-abrt/bin/java
/usr/lib64/libreoffice/ure/share/java
/usr/lib64/libreoffice/share/Scripts/java
/usr/share/java
[root@localhost ~]#

cd  /usr/local/src
wget  http://apache.cdpa.nsysu.edu.tw/hbase/hbase-0.98.5/hbase-0.98.5-hadoop2-bin.tar.gz
tar zxvf hbase-0.98.5-hadoop2-bin.tar.gz -C /usr/local
export HBASE_HOME=/usr/local/hbase-0.98.5-hadoop2

啟動

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

檢查啟動情況

[root@localhost ~]# ps aux | grep hbase
root     62513  0.0  0.0 113120  1568 pts/1    S    14:42   0:00 bash /usr/local/hbase-0.98.5-hadoop2/bin/hbase-daemon.sh --config /usr/local/hbase-0.98.5-hadoop2/conf internal_start master
root     62526 29.8  7.4 1877152 139720 pts/1  Sl   14:42   0:05 java -Dproc_master -XX:OnOutOfMemoryError=kill -9 %p -Xmx1000m -XX:+UseConcMarkSweepGC -Dhbase.log.dir=/usr/local/hbase-0.98.5-hadoop2/logs - hbase.log.file=hbase-root-master-localhost.localdomain.log -Dhbase.home.dir=/usr/local/hbase-0.98.5-hadoop2 -Dhbase.id.str=root -Dhbase.root.logger=INFO,RFA -Dhbase.security.logger=INFO,RFAS org.apache.hadoop.hbase.master.HMaster start
root     62755  0.0  0.0 112640   976 pts/1    R+   14:42   0:00 grep --color=auto hbase
[root@localhost ~]#

進入管理模式


[root@localhost ~]# ${HBASE_HOME}/bin/hbase shell
2014-08-13 14:43:18,387 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.98.5-hadoop2, rUnknown, Mon Aug  4 23:58:06 PDT 2014

hbase(main):001:0>


help說明


hbase(main):001:0> help
HBase Shell, version 0.98.5-hadoop2, rUnknown, Mon Aug  4 23:58:06 PDT 2014
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, table_help, version, whoami

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

  Group name: namespace
  Commands: alter_namespace, create_namespace, describe_namespace, drop_namespace, list_namespace, list_namespace_tables

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

  Group name: tools
  Commands: assign, balance_switch, balancer, catalogjanitor_enabled, catalogjanitor_run, catalogjanitor_switch, close_region, compact, flush, hlog_roll, major_compact, merge_region, move, split, trace, unassign, zk_dump

  Group name: replication
  Commands: add_peer, disable_peer, enable_peer, list_peers, list_replicated_tables, remove_peer, set_peer_tableCFs, show_peer_tableCFs

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

  Group name: security
  Commands: grant, revoke, user_permission

  Group name: visibility labels
  Commands: add_labels, clear_auths, get_auths, set_auths, set_visibility

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):002:0> create "mytable", "mycolumnfamily"
2014-08-13 14:43:54,073 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
0 row(s) in 1.4970 seconds

=> Hbase::Table - mytable


檢視 mytable 資訊

hbase(main):003:0> describe "mytable"
DESCRIPTION                                                                                                                           ENABLED
 'mytable', {NAME => 'mycolumnfamily', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1' true
 , COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'f
 alse', BLOCKCACHE => 'true'}
1 row(s) in 0.0580 seconds


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

hbase(main):001:0>  put "mytable", "myrow", "mycolumnfamily:x", "v"
2014-08-13 14:45:21,573 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
0 row(s) in 0.4130 seconds


顯示值

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

hbase(main):003:0>


掃描 mytable

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

hbase(main):004:0>


離開交談模式

hbase(main):006:0> quit

停止 hbase

[root@localhost ~]# $HBASE_HOME/bin/stop-hbase.sh
stopping hbase.............

(完)

[研究] HBase 0.98.5 資料庫 安裝(CentOS 7.0 x86_64)
http://shaurong.blogspot.com/2014/08/hbase-0985-centos-70-x8664.html

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

沒有留言:

張貼留言