Linux安裝HBase


1、下載

http://archive.apache.org/dist/hbase/1.2.6/hbase-1.2.6-bin.tar.gz

2、解壓

tar -xvf hbase-1.2.6-bin.tar.gz

3、配置環境變量SCALA_HOME 和 PATH

  • vim /etc/profile 或者 vim ~/.bashrc
#Hbase Environment
export HBASE_HOME=$USER_HOME/software/hbase-1.2.6
source /etc/profile 或者 source ~/.bashrc

4、起停腳本

$ZOOKEEPER_HOME/bin/zkServer.sh start
$HBASE_HOME/bin/start-hbase.sh
$HBASE_HOME/bin/stop-hbase.sh
$ZOOKEEPER_HOME/bin/zkServer.sh stop

啟動之后:http://hadoop:16010/master-status

5、測試:$HBASE_HOME/bin/hbase shell

hadoop@hadoop:~/software/hbase-1.2.6/bin$ hbase shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/software/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/software/hbase-1.2.6/lib/client-facing-thirdparty/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 1.2.6, r5b7722f8551bca783adb36a920ca77e417ca99d1, Tue Mar 19 19:05:06 UTC 2019
Took 0.0098 seconds                                                            
hbase(main):001:0> list
TABLE                                                                          
0 row(s)
Took 1.9276 seconds                                                            
=> []
hbase(main):002:0> create 'mytable', 'cf'
Created table mytable
Took 1.4276 seconds                                                            
=> Hbase::Table - mytable
hbase(main):003:0> list
TABLE                                                                          
mytable                                                                        
1 row(s)
Took 0.0367 seconds                                                            
=> ["mytable"]
hbase(main):004:0> put 'mytable', '1', 'cf:msg', 'Hello World'
Took 0.2812 seconds
hbase(main):001:0> put 'mytable', '2', 'cf:blog', 'Hello Ubuntu'
Took 1.6015 seconds                                                            
hbase(main):002:0> get 'mytable', '1'
COLUMN               CELL                                                      
 cf:msg              timestamp=1555401849981, value=Hello World                
1 row(s)
Took 0.1640 seconds                                                            
hbase(main):003:0> scan 'mytable'
ROW                  COLUMN+CELL                                               
 1                   column=cf:msg, timestamp=1555401849981, value=Hello World 
 2                   column=cf:blog, timestamp=1555402006556, value=Hello Ubuntu                                                         
2 row(s)
Took 0.0458 seconds                                                            
hbase(main):004:0> exit


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM