【HBase】HBase数据库基本操作(Shell)

news/2024/5/20 2:57:53 标签: 数据库, hbase, hdfs

 

分享一个有趣的比喻:
HBase像一个骑着大象的士兵,本身并不优秀,却可以耀武扬威——但需要养一头大象(Hadoop)

 
 

检查

▶ cd到Hadoop,开启HDFS

cd /usr/local/hadoop
 ./sbin/start-dfs.sh

▶ cd到Hbase,开启Hbase

cd /usr/local/hadoop
./bin/start-hbase.sh

▶ jsp一下,检查节点是否都正确开启

在这里插入图片描述

 

开启Hbase

bin/hbase shell

 

CURD

创建表

create 'studentInfo', 'Sname', 'Ssex', 'Sage', 'Sdept', 'course'

列出所有表

list

查看某个表的基本信息

describe 'studentInfo'

添加数据

put '表名', '行键', '列族', '单元格CELL中的数据' 

put 'studentInfo', '2233', 'Sname', 'Alice'
put 'studentInfo', '2233', 'course:math', '99'
put 'studentInfo', '2233', 'course:chinese', '88'

查看数据

get 'studentInfo', '2233', 'Sname'		---> 查看一个单元格(+列=单元格CELL)
get 'studentInfo', '2233'				---> 查看一行
scan 'studentInfo'						---> 查看整个表

删除数据

delete 'studentInfo', '2233', 'Sname'
deleteall 'studentInfo', '2233'

删除表(分两步)

disable 'studentInfo'
drop 'studentInfo'

历史数据(体会一下,Hbase中这种覆盖就是更新>_<)

create 'teacherInfo', {NAME=>'username', VERSIONS=>5}
put 'teacherInfo', '1234', 'username', 'Loli_1'
put 'teacherInfo', '1234', 'username', 'Loli_2'
put 'teacherInfo', '1234', 'username', 'Loli_3'
put 'teacherInfo', '1234', 'username', 'Loli_4'
get 'teacherInfo', '1234', {COLUMN=>'username', VERSIONS=>3}
...timestamp=1603787992999... Loli_4 ...
...timestamp=1603787992666... Loli_3 ...
...timestamp=1603787992333... Loli_2 ...

退出Hbase

exit

 
 
 


http://www.niftyadmin.cn/n/1330267.html

相关文章

MongoDB服务器卡死解决

MongoDB服务器卡死&#xff0c;无法ping通&#xff0c;无法远程连接&#xff0c;无法登陆终端&#xff0c;终端显示&#xff1a; CentOS 7- kernel: BUG: soft lockup - CPU#3 stuck for 30s! [xxx:xxx]: 原因分析&#xff1a; 原因1:系统缓存过大引起内存使用率高 原因2:…

动态规划背包问题(洛谷,01背包和完全背包)

ACM学习汇总 P1060 开心的金明 有N元&#xff0c;m件商品&#xff0c;买第i件商品得到的值 t[i] val[i]*wei[i] 求所买商品的t[i]总和最大值 ----------------------------------------------------------------------------- 01背包裸题#include<bits/stdc.h> #defi…

【操作系统1.1】操作系统的特征与发展

第一章——计算机系统概述 1.1 操作系统的特征与发展 1.2 操作系统的体系结构 1.3 中断与系统调用

Case study: IIoT effectiveness on the plant floor

Case study: IIoT effectiveness on the plant floor案例研究&#xff1a;工厂车间的IIoT效果 Collect data to augment equipment effectiveness and for machine eff ciency. automotive supplier HFI approached system integrator MartinCSI to implement Industrial Inte…

【操作系统1.2】操作系统的体系结构

第一章——计算机系统概述 1.1 操作系统的特征与发展 1.2 操作系统的体系结构 1.3 中断与系统调用

【操作系统1.3】中断与系统调用

第一章——计算机系统概述 1.1 操作系统的特征与发展 1.2 操作系统的体系结构 1.3 中断与系统调用

【操作系统2.1】进程与线程

第二章——进程管理 2.1 进程与线程 2.2 处理机调度 2.3 互斥与同步 2.4 死锁

运动标准驱动IIoT

Among the most important standards for industrial motion control are open networking standards for interoperable communications. In a more connected world, machine builders and end users are finding that the digital part of “intelligent” machines is inc…