2015年3月27日 星期五

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

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

2015-03-27

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.75-2.5.4.2.el7_0.x86_64/jre
echo 'export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.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 的
(不要選 /usr/bin/java,有些功能操作下會出問題)

[root@localhost local]# 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.75-2.5.4.2.el7_0.x86_64/jre/bin/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.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 local]#


cd  /usr/local/src
wget  http://apache.stu.edu.tw/hbase/hbase-1.0.0/hbase-1.0.0-bin.tar.gz
tar zxvf   hbase-1.0.0-bin.tar.gz    -C /usr/local
export HBASE_HOME=/usr/local/hbase-1.0.0

啟動

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

檢查啟動情況

[root@localhost local]# ps aux | grep hbase
root      14842  0.0  0.0 113120  1564 pts/1    S    04:02   0:00 bash /usr/local/hbase-1.0.0/bin/hbase-daemon.sh --config /usr/local/hbase-1.0.0/conf internal_start master
root      14856 14.0  7.1 1584372 134344 pts/1  Sl   04:02   0:06 java -Dproc_master -XX:OnOutOfMemoryError=kill -9 %p -XX:+UseConcMarkSweepGC -Dhbase.log.dir=/usr/local/hbase-1.0.0/logs -Dhbase.log.file=hbase-root-master-localhost.localdomain.log -Dhbase.home.dir=/usr/local/hbase-1.0.0 -Dhbase.id.str=root -Dhbase.root.logger=INFO,RFA -Dhbase.security.logger=INFO,RFAS org.apache.hadoop.hbase.master.HMaster start
root      15168  0.0  0.0 112640   980 pts/1    R+   04:02   0:00 grep --color=auto hbase
[root@localhost local]# 

進入管理模式


[root@localhost local]# $HBASE_HOME/bin/hbase shell

2015-03-27 04:13:18,714 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.0.0, r6c98bff7b719efdb16f71606f3b7d8229445eb81, Sat Feb 14 19:49:22 PST 2015

hbase(main):001:0>



help說明


hbase(main):001:0> help
HBase Shell, version 1.0.0, r6c98bff7b719efdb16f71606f3b7d8229445eb81, Sat Feb 14 19:49:22 PST 2015
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, compact_rs, flush, major_compact, merge_region, move, split, trace, unassign, wal_roll, zk_dump

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

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

  Group name: configuration
  Commands: update_all_config, update_config

  Group name: security
  Commands: grant, revoke, user_permission

  Group name: visibility labels
  Commands: add_labels, clear_auths, get_auths, list_labels, 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/book.html
hbase(main):002:0>


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


hbase(main):002:0> create "mytable", "mycolumnfamily"
0 row(s) in 0.4600 seconds

=> Hbase::Table - mytable
hbase(main):003:0>


檢視 mytable 資訊


hbase(main):003:0> describe "mytable"
Table mytable is ENABLED
mytable
COLUMN FAMILIES DESCRIPTION
{NAME => 'mycolumnfamily', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW',
REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS =
> '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN
_MEMORY => 'false', BLOCKCACHE => 'true'}
1 row(s) in 0.0310 seconds

hbase(main):004:0>


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


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

hbase(main):005:0>


顯示值


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

hbase(main):006:0>


掃描 mytable


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

hbase(main):007:0>


離開交談模式

hbase(main):007:0> quit

停止 hbase

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

(完)

[研究] HBase 1.0.0 資料庫 安裝(CentOS 7.0 x86_64)
http://shaurong.blogspot.com/2015/03/hbase-100-centos-70-x8664.html

[研究] 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

沒有留言:

張貼留言