当前位置:   article > 正文

HBase常用shell命令_根据上面的student表的信息,完成下列操作1)用hbase shell命令创建student表,

根据上面的student表的信息,完成下列操作1)用hbase shell命令创建student表,并录

一、介绍

本篇博文主要举一个例子来说明一下HBase shell,文末将会介绍两篇详细的关于HBase常用Shell使用的博文。

二、实验内容

name

score

English

Math

Computer

zhangsan

69

86

77

lisi

55

100

88

根据上面给出的Student表的信息,执行如下操作。

1.用HBase Shell命令创建学生表Student,并将数据插入表中。

  1. 进入hbase shell
  2. [hadoop@MASTER ~]$ hbase shell
  1. 创建student表和score列族
  2. hbase(main):011:0> create 'student','score'
  3. 0 row(s) in 1.2810 seconds
  4. => Hbase::Table - student

  1. 添加数据到表中
  2. hbase(main):012:0> put 'student','zhangsan','score:English','69'
  3. 0 row(s) in 0.1320 seconds
  4. hbase(main):013:0> put 'student','zhangsan','score:Math','86'
  5. 0 row(s) in 0.0090 seconds
  6. hbase(main):014:0> put 'student','zhangsan','score:Computer','77'
  7. 0 row(s) in 0.0110 seconds
  8. hbase(main):001:0> put 'student','lisi','score:English','55'
  9. 0 row(s) in 0.8190 seconds
  10. hbase(main):002:0> put 'student','lisi','score:Math','100'
  11. 0 row(s) in 0.0200 seconds
  12. hbase(main):003:0> put 'student','lisi','score:Computer','88'
  13. 0 row(s) in 0.0250 seconds

2. 用Scan命令浏览Student表的相关信息。

hbase(main):004:0> scan 'student'

3. 查询zhangsan的Computer成绩。

hbase(main):005:0> get 'student','zhangsan','score:Computer'

4. 修改lisi的Math成绩,改为95。

修改成绩,也就是把成绩覆盖

hbase(main):009:0> put 'student','lisi','score:Math','95'

5. 向Student表中添加数据:name为wangwu,English为80,Math为90,Computer为100,History为70。

6. 统计表的行数。

count 'student'

参考文献

【1】https://www.cnblogs.com/cxzdy/p/5583239.html

【2】https://www.cnblogs.com/kaituorensheng/p/3814925.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/502423
推荐阅读
相关标签
  

闽ICP备14008679号