HBASE-单节点安装使用简介(UBUNTU 11)

一、环境
机器版本:Ubuntu 11 32bit

hbase版本:hbase-0.90.3

jdk版本:
               jdk-6u27-linux-i586
               Linux x86 - Self Extracting Installer
下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html
root@dm1:/usr/java# sh ./jdk-6u27-linux-i586.bin

jdk安装后配置,环境变量:
vim /etc/profile
添加
export JAVA_HOME=/usr/java/jdk1.6.0_27
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar


二、HBASE 配置

解压 hbase-0.90.3.tar.gz

./conf目录 配置hbase-env.sh 增加:

export JAVA_HOME=/usr/java/jdk1.6.0_27/

 

添加配置存放文件路径:hbase-site.xml (如果没有配置默认存放在/tmp目录下,重启电脑后数据删除)

 

<property>
<name>hbase.rootdir</name>
<value>/usr/hadoop/hbase-0.90.3/data</value>
<description>local dir
</description>
</property>

 

单节点就这样安装好了,下面是启动和简单使用

 


三、使用
HBASE启动进 bin目录
root@dm1:/usr/hadoop/hbase-0.90.3/bin# sh ./start-hbase.sh
HBASE停止 进bin目录
root@dm1:/usr/hadoop/hbase-0.90.3/bin# sh ./stop-hbase.sh

1、登录Hbase shell  进bin目录

root@dm1:/usr/hadoop/hbase-0.90.3/bin# ./hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.90.3, r1100350, Sat May  7 13:31:12 PDT 2011

hbase(main):001:0>


2、建表
hbase(main):001:0> create 'tb_a','vddb','mw'   
0 row(s) in 2.3740 seconds

hbase(main):002:0>


3、插入vddb 列 2个数据 begin_dt & end_dt  没法一次put 一行的多个字段

hbase(main):007:0* put 'tb_a','task001','vddb:begin_dt','2011-10-12 18:00:00'                                  
0 row(s) in 0.2320 seconds

hbase(main):010:0* put 'tb_a','task001','vddb:end_dt','2011-10-12 18:00:10'                                    

0 row(s) in 0.0480 seconds

4、查询
hbase(main):012:0* scan 'tb_a'
ROW                                           COLUMN+CELL                                                                                                                      
task001                                      column=vddb:begin_dt, timestamp=1318416290895, value=2011-10-12 18:00:00                                                         
task001                                      column=vddb:end_dt, timestamp=1318416304997, value=2011-10-12 18:00:10                                                           
1 row(s) in 0.1820 seconds


  hbase(main):013:0> get 'tb_a','task001'
COLUMN                                        CELL                                                                                                                             
vddb:begin_dt                                timestamp=1318416290895, value=2011-10-12 18:00:00                                                                               
vddb:end_dt                                  timestamp=1318416304997, value=2011-10-12 18:00:10                                                                               
2 row(s) in 0.0760 seconds

查询条件过滤

scan 'traceLogTask',{column =>['uuid'],LIMIT =>2,STARTROW =>'2011101710010002'}

 

scan 'traceLogTask',{COLUMN =>['uuid','VDDB:'],STARTROW =>'2011101710010002',STOPROW =>'2011101710010004'}

 

页面访问:

http://localhost:60010


总结:单点安装很简单,更多功能后面出

 

你可能感兴趣的:(hadoop,hbase)