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'