当前位置:   article > 正文

6.5 实训任务 HBase shell 常见命令的使用_hbase创建学生表

hbase创建学生表

0、进入HBase shell

cd /home/bigdata/Opt/hbase-2.4.12/bin
./hbase shell

1、 创建成绩表,列簇为 id,name,course

create 'scores','id','name','course'

````````````emo emo emo emo emo emo emo`````````````````,报错了·······

ERROR: KeeperErrorCode = ConnectionLoss for /hbase/master

2、查看当前HBase里有哪些表

list

3、查看当前表scores的表结构

describe 'scores'

4、按照给定成绩表,插入数据

  1. put 'scores','20220510','name:name','LanLan'
  2. put 'scores','20220510','course:chinese','85'
  3. put 'scores','20220510','course:math','90'
  4. put 'scores','20220510','course:english','92'
  5. put 'scores','20220511','name:name','XiQi'
  6. put 'scores','20220511','course:chinese','86'
  7. put 'scores','20220511','course:math','95'
  8. put 'scores','20220511','course:english','98'
  9. put 'scores','20220512','name:name','YangYan'
  10. put 'scores','20220512','course:chinese','95'
  11. put 'scores','20220512','course:math','80'
  12. put 'scores','20220512','course:english','82'

5、扫描当前表scores里的数据

scan 'scores'

6、查看序号为20220510的学生的姓名,查看序号为 20220510学生的数学成绩

  1. get 'scores','20225010','name'
  2. get 'scores','20220510','course:math'

7、修改scores表中数据,序号为20220511学生的姓名,20220512学生的英语成绩

  1. disable 'scores'
  2. alter 'scores','20220511','name','NiCai'
  3. alter 'scores','20220512','course:english'=>'99'
  4. enable 'scores'
  5. scan 'scores'

8、删除当前表scores中序号为20220510的学生的数学成绩

  1. disable 'scores'
  2. alter 'scores','20220510','course:math'=>'delete'
  3. enable 'scores'
  4. scan 'scores'

9、统计当前表scores里的数据记录的条数

count 'scores'

10、刷新当前表scores

flush 'scores'

11、查看当前用户

whoami

12、删除当前表scores中序号为20220510的学生信息

  1. deleteall 'scores','20220510'
  2. scan 'scores'

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

闽ICP备14008679号