大數據之Hadoop學習(九)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'

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章