HBase Shell数据访问操作
所构建的表在前面的博客里有提到(链接如下:https://blog.csdn.net/qq_42585108/article/details/105508240)
事前准备:
1.启动Hadoop
cd /usr/local/hadoop/
./sbin/start-dfs.sh
2.启动HBase
cd /usr/local/hbase/
bin/start-hbase.sh
3.进入shell
./bin/hbase shell
一、使用HBase Shell命令向第1题所构建的HBase数据表中添加适宜数据;
put 'StudentAdmin','2015004','student:S_Name','WeiDaDa'
put 'StudentAdmin','2015004','student:S_Age','23'
put 'StudentAdmin','2015004','student:S_Sex','male'
put 'StudentAdmin','2015004','course1:C_No','123001'
put 'StudentAdmin','2015004','course1:C_Name','Math'
put 'StudentAdmin','2015004','course1:C_Credit','2.0'
put 'StudentAdmin','2015004','course1:Score','100'
二、使用HBase Shell命令从第1题所构建的HBase数据表中查询出数据;
查询学号为2015004的所有信息
get 'StudentAdmin','2015004'
三、使用HBase Shell命令从第1题所构建的HBase数据表中删除任一数据;
删除学号为2015004学生的性别单元
delete 'StudentAdmin','2015004','student:S_Sex'
在用get命令查看
get 'StudentAdmin','2015004'
发现成功删除了该学生的性别单元
四、使用HBase Shell命令统计第1题所构建的HBase数据表的行数。
count 'StudentAdmin'