扣丁学堂Linux培训简述HBASE常用shell命令增删改查的方法

2019-04-22 15:01:08 1468浏览

Linux开发技术从面世以来就备受人们的关注,参加Linux培训学习Linux开发技术的小伙伴一直都不曾减少,而Linux开发工程师也很受各大公司企业的青睐,本篇文章扣丁学堂Linux培训小编就给喜欢Linux开发技术的小伙伴分享一下HBASE常用shell命令增删改查的方法,感兴趣的小伙伴就随小编来了解一下吧。


扣丁学堂Linux培训简述HBASE常用shell命令增删改查的方法


1、首先给出本次操作的数据


create 'student','info','address'
put 'student','1','info:age','20'
put 'student','1','info:name','wang'
put 'student','1','info:class','1'
put 'student','1','address:city','zhengzhou'
put 'student','1','address:area','High-tech zone'
put 'student','2','info:age','21'
put 'student','2','info:name','yang'
put 'student','2','info:class','1'
put 'student','2','address:city','beijing'
put 'student','2','address:area','CBD'
put 'student','3','info:age','22'
put 'student','3','info:name','zhao'
put 'student','3','info:class','2'
put 'student','3','address:city','shanghai'
put 'student','3','address:area','pudong'
scan 'student'


2、首先执行,创建表,增加数据操作,执行脚本 /bin/hbase shell ./student.txt,然后查看内容 scan ‘student'


hbase(main):001:0> scan 'student'
ROW      COLUMN+CELL
 1       column=address:area, timestamp=1491533426260, value=High-tech zone
 1       column=address:city, timestamp=1491533426239, value=zhengzhou
 1       column=info:age, timestamp=1491533426179, value=20
 1       column=info:class, timestamp=1491533426218, value=1
 1       column=info:name, timestamp=1491533426211, value=wang
 2       column=address:area, timestamp=1491533426297, value=CBD
 2       column=address:city, timestamp=1491533426292, value=beijing
 2       column=info:age, timestamp=1491533426269, value=21
 2       column=info:class, timestamp=1491533426287, value=1
 2       column=info:name, timestamp=1491533426277, value=yang
 3       column=address:area, timestamp=1491533426329, value=pudong
 3       column=address:city, timestamp=1491533426323, value=shanghai
 3       column=info:age, timestamp=1491533426305, value=22
 3       column=info:class, timestamp=1491533426317, value=2
 3       column=info:name, timestamp=1491533426311, value=zhao
3 row(s) in 0.1940 seconds


3、修改操作 也是用put命令,就是重新添加内容把,把以前的内容覆盖。


格式 put 't1', 'r1', 'c1', 'value'
命令 put 'student','1','info:age','18'
结果
hbase(main):010:0> get 'student','1'
COLUMN      CELL
 address:area    timestamp=1491533426260, value=High-tech zone
 address:city    timestamp=1491533426239, value=zhengzhou
 info:age     timestamp=1491533823331, value=18
 info:class    timestamp=1491533426218, value=1
 info:name     timestamp=1491533426211, value=wang
5 row(s) in 0.0110 seconds


4、删除操作,分为删除单元格的内容,和整行删除

单元格


hbase(main):012:0> delete 'student','1','info:name'
0 row(s) in 0.0800 seconds

hbase(main):014:0> get 'student','1'
COLUMN      CELL
 address:area    timestamp=1491533426260, value=High-tech zone
 address:city    timestamp=1491533426239, value=zhengzhou
 info:age     timestamp=1491533823331, value=18
 info:class    timestamp=1491533426218, value=1
4 row(s) in 0.0120 seconds


整行


hbase(main):023:0> deleteall 'student','1'
0 row(s) in 0.0260 seconds

hbase(main):024:0> get 'student','1'
COLUMN      CELL
0 row(s) in 0.0070 seconds


5、查询

单行查询


hbase(main):026:0> get 'student','2'
COLUMN      CELL
 address:area    timestamp=1491533426297, value=CBD
 address:city    timestamp=1491533426292, value=beijing
 info:age     timestamp=1491533426269, value=21
 info:class    timestamp=1491533426287, value=1
 info:name     timestamp=1491533426277, value=yang
5 row(s) in 0.0190 seconds


指定列族


hbase(main):028:0> get 'student', '2', {COLUMN => 'info'}
COLUMN      CELL
 info:age     timestamp=1491533426269, value=21
 info:class    timestamp=1491533426287, value=1
 info:name     timestamp=1491533426277, value=yang
3 row(s) in 0.0150 seconds


指定列名


hbase(main):029:0> get 'student', '2', {COLUMN => 'info:age'}
COLUMN      CELL
 info:age     timestamp=1491533426269, value=21
1 row(s) in 0.0080 seconds


使用scan,指定startrow


 hbase(main):031:0> scan 'student', {COLUMNS => ['info:age', 'address'], LIMIT => 10, STARTROW => '2'}
ROW      COLUMN+CELL
 2       column=address:area, timestamp=1491533426297, value=CBD
 2       column=address:city, timestamp=1491533426292, value=beijing
 2       column=info:age, timestamp=1491533426269, value=21
 3       column=address:area, timestamp=1491533426329, value=pudong
 3       column=address:city, timestamp=1491533426323, value=shanghai
 3       column=info:age, timestamp=1491533426305, value=22
2 row(s) in 0.0190 seconds


scan指定过滤


hbase(main):005:0> scan 'student',{FILTER=>"(TimestampsFilter (1491533426297))"}
ROW      COLUMN+CELL
 2       column=address:area, timestamp=1491533426297, value=CBD
1 row(s) in 0.0170 seconds



最后想要了解更多关于Linux开发方面内容的小伙伴,请关注扣丁学堂Linux培训官网、微信等平台,扣丁学堂IT职业在线学习教育平台为您提供权威的Linux开发环境搭建视频,Linux培训后的前景无限,行业薪资和未来的发展会越来越好的,通过千锋扣丁学堂金牌讲师在线录制的Linux开发教程,让你快速掌握Linux从入门到精通开发实战技能。扣丁学堂Linux技术交流群:422345477。


扣丁学堂微信公众号                          Python全栈开发爬虫人工智能机器学习数据分析免费公开课直播间


      【关注微信公众号获取更多学习资料】         【扫码进入Python全栈开发免费公开课】




查看更多关于“Linux培训资讯”的相关文章>>

标签: linux系统入门学习 linux培训 linux视频教程 linux基础教程 linux在线视频 linux在线学习 linux从入门到精通 linux开发环境包 linux系统 linux开发教程

热门专区

暂无热门资讯

课程推荐

微信
微博
15311698296

全国免费咨询热线

邮箱:codingke@1000phone.com

官方群:148715490

北京千锋互联科技有限公司版权所有   北京市海淀区宝盛北里西区28号中关村智诚科创大厦4层
京ICP备12003911号-6   Copyright © 2013 - 2019

京公网安备 11010802030908号