文档章节

hbase增删改查操作

泡海椒
 泡海椒
发布于 2016/01/18 20:38
字数 850
阅读 72
收藏 2

hbase(main):005:0> list
hbase(main):005:0> help "create"
hbase(main):008:1' create 'user_info', {NAME=>'base_info',VERSIONS=>3},{NAME=>'extra_info'}

=> Hbase::Table - user_info
hbase(main):003:0> put 'user_info','001','base_info:name','fengjie';
hbase(main):004:0* list
0 row(s) in 0.2730 seconds
hbase(main):005:0> put 'user_info','001','base_info:age',28
0 row(s) in 0.0180 seconds

hbase(main):006:0> put 'user_info','001','base_info:addr','newyork'
0 row(s) in 0.0160 seconds

base(main):007:0> put 'user_info','001','extra_info:addr','female'
0 row(s) in 0.0270 seconds

hbase(main):008:0> put 'user_info','001','base_info:phone','138138'
0 row(s) in 0.0200 seconds
hbase(main):013:0> scan 'user_info'
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453116210831, value=fengjie                                    
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female
 
 插入数据后,hbase会给数据进行排序,行健利用字典顺序排序,列族利用key进行排序
 
 hbase(main):016:0> get 'user_info' ,'001'
COLUMN                             CELL                                                                                             
 base_info:addr                    timestamp=1453116330696, value=newyork                                                           
 base_info:age                     timestamp=1453116278159, value=28                                                                
 base_info:name                    timestamp=1453116210831, value=fengjie                                                           
 base_info:phone                   timestamp=1453116447397, value=138138                                                            
 extra_info:addr                   timestamp=1453116383154, value=female                                                            
5 row(s) in 0.0430 seconds

hbase(main):017:0> put  'user_info' ,'001' ,'base_info:name','fengfeng'
0 row(s) in 0.0200 seconds
hbase(main):018:0> put  'user_info' ,'001' ,'base_info:name','luoyufeng6~'
0 row(s) in 0.0220 seconds

nfo:addr                    timestamp=1453116330696, value=newyork                                                           
 base_info:age                     timestamp=1453116278159, value=28                                                                
 base_info:name                    timestamp=1453116898848, value=luoyufeng6~                                                       
 base_info:phone                   timestamp=1453116447397, value=138138                                                            
 extra_info:addr                   timestamp=1453116383154, value=female                                                            
5 row(s) in 0.0600 seconds

base(main):021:0> get 'user_info' ,'001' ,{COLUMN=>'base_info:name',VERSIONS=>10}
COLUMN                             CELL                                                                                             
 base_info:name                    timestamp=1453116898848, value=luoyufeng6~                                                       
 base_info:name                    timestamp=1453116856832, value=fengfeng                                                          
 base_info:name                    timestamp=1453116210831, value=fengjie                                                           
3 row(s) in 0.0470 seconds


hbase(main):022:0> put  'user_info' ,'001' ,'base_info:name','FENGBAOBAO'
0 row(s) in 0.0270 seconds

hbase(main):023:0> get 'user_info' ,'001' ,{COLUMN=>'base_info:name',VERSIONS=>10}
COLUMN                             CELL                                                                                             
 base_info:name                    timestamp=1453117097894, value=FENGBAOBAO                                                        
 base_info:name                    timestamp=1453116898848, value=luoyufeng6~                                                       
 base_info:name                    timestamp=1453116856832, value=fengfeng                                                          
3 row(s) in 0.0520 seconds

hbase(main):026:0> scan 'user_info' ,{RAW=>true,VERSIONS=>5}
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453117097894, value=FENGBAOBAO                                 
 001                               column=base_info:name, timestamp=1453116898848, value=luoyufeng6~                                
 001                               column=base_info:name, timestamp=1453116856832, value=fengfeng                                   
 001                               column=base_info:name, timestamp=1453116210831, value=fengjie                                    
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female  
 
 base(main):028:0> scan 'user_info' ,{RAW=>true,VERSIONS=>5}
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453117366851, value=fengwujiutian                              
 001                               column=base_info:name, timestamp=1453117097894, value=FENGBAOBAO                                 
 001                               column=base_info:name, timestamp=1453116898848, value=luoyufeng6~                                
 001                               column=base_info:name, timestamp=1453116856832, value=fengfeng                                   
 001                               column=base_info:name, timestamp=1453116210831, value=fengjie                                    
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female                                    
1 row(s) in 0.1780 seconds

hbase(main):029:0> scan 'user_info' ,{VERSIONS=>5}
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453117366851, value=fengwujiutian                              
 001                               column=base_info:name, timestamp=1453117097894, value=FENGBAOBAO                                 
 001                               column=base_info:name, timestamp=1453116898848, value=luoyufeng6~                                
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female       
 

ain):030:0> put  'user_info' ,'002' ,'base_info:name','Furong'
hbase(main):031:0> put  'user_info' ,'002' ,'base_info:age','30'
hbase(main):032:0> put  'user_info' ,'002' ,'base_info:addr','beijing'

hbase(main):033:0> scan 'user_info'
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453117366851, value=fengwujiutian                              
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female                                    
 002                               column=base_info:addr, timestamp=1453117653480, value=beijing                                    
 002                               column=base_info:age, timestamp=1453117640213, value=30                                          
 002                               column=base_info:name, timestamp=1453117601510, value=Furong       
 
 e(main):044:0> get 'user_info','002' ,{FILTER=>"ValueFilter(=,'binary:beijing')"}
COLUMN                             CELL                                                                                             
 base_info:addr                    timestamp=1453117653480, value=beijing                                                           
1 row(s) in 0.1620 seconds

hbase(main):046:0> scan 'user_info' ,{STARTROW=>'001',LIMIT=>2}
ROW                                COLUMN+CELL                                                                                      
 001                               column=base_info:addr, timestamp=1453116330696, value=newyork                                    
 001                               column=base_info:age, timestamp=1453116278159, value=28                                          
 001                               column=base_info:name, timestamp=1453117366851, value=fengwujiutian                              
 001                               column=base_info:phone, timestamp=1453116447397, value=138138                                    
 001                               column=extra_info:addr, timestamp=1453116383154, value=female                                    
 002                               column=base_info:addr, timestamp=1453117653480, value=beijing                                    
 002                               column=base_info:age, timestamp=1453117640213, value=30                                          
 002                               column=base_info:name, timestamp=1453117601510, value=Furong                                     
2 row(s) in 0.0320 seconds


© 著作权归作者所有

上一篇: ACTIVEMQ 之uri
泡海椒
粉丝 11
博文 282
码字总数 288344
作品 0
成都
程序员
私信 提问
hbase 数据库简介安装与常用命令的使用

一:hbase 简介与架构功能 二:hbase 安装与配置 三:hbase 常见shell 命令操作 一:hbase 简介与架构功能 1.1 为什么要使用hbase 数据库 1.2 hbase 简介: 1.3 HBase与Hadoop的对比 1.4 HB...

flyfish225
2018/04/12
0
0
hbase使用restful接口进行数据操作

HBase Rest 是建立在HBase java 客户端基础之上的,提供的web 服务。它存在的目的是给开发者一个更多的选择。 1.启动rest 服务 (1)hbase rest start 用默认的方式启动rest服务,端口是808...

数据架构师
01/02
0
0
基于HBase的实时历史数据库设计思路

实时历史数据库是实现工业海量数据采集存储的有效手段。HBase的写入性能优于查询性能,这个特点使其适合作为实时历史数据库开发的基础。 所有的开发是基于HBase的API进行,主要开发节点和数据...

什么都没想到
2017/10/23
0
0
使用Nodejs通过thrift框架访问HBase卡住不动问题

Ubuntu14.04搭建HBase环境成功,在hbase shell里增删改查操作都没有问题。用HBASE的restAPI也可以访问。但用nodejs通过thrift框架访问HBase时,代码执行到client.openScanner这行就卡住了,也...

TateYao
2017/03/15
183
0
hbase之hbase常用shell命令

1、普通操作 进入shell [qiqi@c1 ~]$ hbase shell 查看当前用户 hbase(main):001:0> whoami (如果有 kerberos 认证,需要事先使用相应的 keytab 进行一下认证(使用 kinit 命令), 认证成功...

伊人心
02/21
0
0

没有更多内容

加载失败,请刷新页面

加载更多

瓜哥奇遇记

庚子年秋, 瓜哥在黄石公园开枪射杀了杨耀东. 同年腊月, America 政府想要在 Montaña 审判他, 瓜哥称这违反了 America 第六修正案, 得以无罪释放. 辛丑年, 三月, 泛大洋. 一艘航船行驶在平平...

王氾超-E_Convorn_Ares
32分钟前
1
0
java对redis的基本操作

一、server端安装   1、下载     https://github.com/MSOpenTech/redis     可看到当前可下载版本:redis2.6          下载windows平台文件:               ...

boonya
33分钟前
1
0
自定义配置类

1.自定义配置类 在web开发中经常会用到配置文件,将配置文件中的属性自动注入到配置类中。 在application.properties文件中添加配置属性 com.neo.title=zabbix触发器com.neo.description=监...

贾峰uk
52分钟前
2
0
IDEA常用设置

1、鼠标悬停一秒看提示 2、自动导包 3、行号、分隔符 4、忽略大小写 5、多行线束操作 6、设置字体以及大小 7、设置注释字体颜色 8、设置文档注释信息 /** @author hll @date ${DATE} - ...

一只小青蛙
56分钟前
2
0
8.eclipse 安装 lombook插件

1.效果 2.安装过程 参考: https://blog.csdn.net/zflovecf/article/details/80178679 2.1 下载插件 https://projectlombok.org/download.html 并放入eclipse所在目录 (位置参考下图) 2.2 ......

20190513
今天
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部