您的位置:首页 > 运维架构 > Shell

HBase Shell数据库操作

2020-07-14 06:13 567 查看

HBase Shell数据库操作

数据库表创建


创建学生表(Student)

./bin/hbase shell
create 'Student','S_ID','S_Name','S_Sex','S_Age'


创建课程表(Course)

create 'Course','C_ID','C_Name','C_Credit'


创建选课表(Selected_Course)

create 'Selected_Course','SC_ID','C_ID','SC_Score'


查看已创建的表

list

HBase Shell 数据访问操作

学生表(Student)添加3条记录
注意:每一行的数据,需要每一列添加,否则会报错

显示学生表(Student)记录

scan 'Student'


课程表(Course)添加3条记录

显示课程表(Course)记录

scan 'Course'

选课表(Selected_Course)添加4条记录

显示选课表(Selected_Course)记录

scan 'Selected_Course'

HBASE 数据访问程序设计

HBase Shell命令显示学生表(Student)记录

scan 'Student'


HBase Shell命令从课程表中查询(get)任意一条数据

get 'Course','c0001'


使用HBase Shell命令将选课表(Selected_Course)删除

disable 'Selected_Course'
drop 'Selected_Course'
list


HBase Shell数据库操作到此就结束了。如果博客中有问题,欢迎各位大神们指点迷津鸭。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: