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