2016年5月4日 星期三

[研究] HBase 1.2.1 資料庫 安裝(CentOS 7.2 x86_64)

[研究] HBase 1.2.1 資料庫 安裝(CentOS 7.2 x86_64)

2016-05-04

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.91-2.6.2.3.el7.x86_64/jre
echo 'export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.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 ~]# find / -name java
/etc/pki/ca-trust/extracted/java
/etc/pki/java
/etc/alternatives/java
/etc/java
/var/lib/alternatives/java
/usr/bin/java
/usr/lib/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64/jre/bin/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64/jre-abrt/bin/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el7_2.x86_64/jre/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.stu.edu.tw/hbase/1.2.1/hbase-1.2.1-bin.tar.gz
tar zxvf hbase-1.2.1-bin.tar.gz -C /usr/local
export HBASE_HOME=/usr/local/hbase-1.2.1

啟動

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

檢查啟動情況


[root@localhost ~]# ps aux | grep hbase
root      13020  0.0  0.0 113120  1584 pts/0    S    15:07   0:00 bash /usr/local/hbase-1.2.1/bin/hbase-daemon.sh --config /usr/local/hbase-1.2.1/conf foreground_start master
root      13034 35.4  3.6 1858016 141908 pts/0  Sl   15:07   0:08 java -Dproc_master -XX:OnOutOfMemoryError=kill -9 %p -XX:+UseConcMarkSweepGC -XX:PermSize=128m -XX:MaxPermSize=128m -Dhbase.log.dir=/usr/local/hbase-1.2.1/logs -Dhbase.log.file=hbase-root-master-localhost.localdomain.log -Dhbase.home.dir=/usr/local/hbas -1.2.1 -Dhbase.id.str=root -Dhbase.root.logger=INFO,RFA -Dhbase.security.logger=INFO,RFAS org.apache.hadoop.hbase.master.HMaster start
root      13359  0.0  0.0 112644   952 pts/0    R+   15:07   0:00 grep --color=auto hbase
[root@localhost ~]#


進入管理模式


[root@localhost ~]# $HBASE_HOME/bin/hbase shell
2016-05-04 15:08:13,851 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.2.1, r8d8a7107dc4ccbf36a92f64675dc60392f85c015, Wed Mar 30 11:19:21 CDT 2016

hbase(main):001:0>


help說明


hbase(main):001:0> help
HBase Shell, version 1.2.1, r8d8a7107dc4ccbf36a92f64675dc60392f85c015, Wed Mar 30 11:19:21 CDT 2016
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, locate_region, 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, get_splits, incr, put, scan, truncate, truncate_preserve

  Group name: tools
  Commands: assign, balance_switch, balancer, balancer_enabled, catalogjanitor_enabled, catalogjanitor_run, catalogjanitor_switch, close_region, compact, compact_rs, flush, major_compact, merge_region, move, normalize, normalizer_enabled, normalizer_switch, split, trace, unassign, wal_roll, zk_dump

  Group name: replication
  Commands: add_peer, append_peer_tableCFs, disable_peer, disable_table_replication, enable_peer, enable_table_replication, 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: quotas
  Commands: list_quotas, set_quota

  Group name: security
  Commands: grant, list_security_capabilities, revoke, user_permission

  Group name: procedures
  Commands: abort_procedure, list_procedures

  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=1462345842547, value=v
1 row(s) in 0.0680 seconds

hbase(main):006:0>


掃描 mytable


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

hbase(main):007:0>


離開交談模式

hbase(main):007:0> quit

停止 hbase

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

(完)

[研究] HBase 1.2.1 資料庫 安裝(CentOS 7.2 x86_64)
http://shaurong.blogspot.com/2016/05/hbase-121-centos-72-x8664.html

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

沒有留言:

張貼留言