“林子雨大数据” 实验3 HBase操作与接口编程
环境搭建
VM虚拟机和Ubuntu系统的安装
在Windows中使用VirtualBox安装Ubuntu虚拟机(2020年7月版本)_厦大数据库实验室博客 (xmu.edu.cn)
Hadoop安装(伪分布式)
Hadoop3.1.3安装教程_单机/伪分布式配置_Hadoop3.1.3/Ubuntu18.04(16.04)_厦大数据库实验室博客 (xmu.edu.cn)
HBase安装(伪分布式)
HBase2.2.2安装和编程实践指南_厦大数据库实验室博客 (xmu.edu.cn)
通过NAT转发使本地主机连接虚拟机
PowerShell SSH 连接 VirtualBox Ubuntu 虚拟机的具体步骤 - 小能日记 - 博客园 (cnblogs.com)
文件传输工具
FlashFXP - Secure FTP Client Software for Windows. Upload, Download, and Synchronize your files.
在VSCODE中使用SSH进行远程开发
在VScode中使用SSH进行远程开发_vscode ssh_Shipmaster_23的博客-CSDN博客
Linux中安装go环境并运行
【golang】linux中安装go环境并运行_linux 运行golang_沉默小管的博客-CSDN博客
理解Hbase
我终于看懂了HBase,太不容易了... - 知乎 (zhihu.com)
第三方软件包
tsuna/gohbase: Pure-Go HBase client (github.com)
hrpc package - github.com/tsuna/gohbase/hrpc - Go Packages
gin框架 · Go语言中文文档 (topgoer.com)
遇到过的问题
Linux 查看端口占用情况 | 菜鸟教程 (runoob.com)
接口编程
func Router(r *gin.Engine) {
r.GET("/", controller.HelloWorld)
r.GET("/TableList", controller.ShowTableList) // 1.1
r.GET("/TableRows", controller.ShowTableRows) // 1.2
r.POST("/TableInsertRowCol", controller.TableInsertRowCol) // 1.3
r.POST("/TableDeleteRowCol", controller.TableDeleteRowCol) // 1.3
r.GET("/TableTruncate", controller.TableTruncate) // 1.4
r.GET("/TableRowsCount", controller.ShowTableRowsCount) // 1.5
r.POST("/TableCreate", controller.TableCreate) // 3.1
r.POST("/TableInsertRow", controller.TableInsertRow) // 3.2
r.GET("/TableColumnScan", controller.TableColumnScan) // 3.3
r.POST("/TableModifyData", controller.TableInsertRowCol) // 3.4 same as 1.3
r.POST("/TableDeleteRow", controller.TableDeleteRow) // 3.5
}
实验过程
启动服务
ssh xiaoneng@127.0.0.1 -p 10022
cd /usr/local/hadoop
./sbin/start-dfs.sh
cd /usr/local/hbase
bin/start-hbase.sh
cd /usr/local/hbase
bin/hbase shell
创建三个表
对应第2题答案
create 'student','S_No','S_Name','S_Sex','S_Age'
put 'student','s001','S_No','2015001'
put 'student','s001','S_Name','zhangsan'
put 'student','s001','S_Sex','male'
put 'student','s001','S_Age','23'
put 'student','s002','S_No','2015002'
put 'student','s002','S_Name','Mary'
put 'student','s002','S_Sex','female'
put 'student','s002','S_Age','22'
put 'student','s003','S_No','2015003'
put 'student','s003','S_Name','Lisi'
put 'student','s003','S_Sex','male'
put 'student','s003','S_Age','24'
create 'course','C_No','C_Name','C_Credit'
put 'course','c001','C_No','123001'
put 'course','c001','C_Name','Math'
put 'course','c001','C_Credit','2.0'
put 'course','c002','C_No','123002'
put 'course','c002','C_Name','Computer'
put 'course','c002','C_Credit','5.0'
put 'course','c003','C_No','123003'
put 'course','c003','C_Name','English'
put 'course','c003','C_Credit','3.0'
create 'SC','SC_Sno','SC_Cno','SC_Score'
put 'SC','sc001','SC_Sno','2015001'
put 'SC','sc001','SC_Cno','123001'
put 'SC',