【hbase】hbase的shell操作笔记
HBase Shell
$ ./bin/hbase shell # 进入交互界面
DDL操作:
create:创建表(默认命名空间为default)
# create '表名','列族1','列族2'...
hbase(main):005:0> create 'student','info'
0 row(s) in 1.4250 seconds
=> Hbase::Table - student
list:列出所有table
hbase(main):005:0> list # 列出所有的Table
TABLE
student
1 row(s) in 0.0160 seconds
=> ["student"]describe '表名':查看表详细信息
# 查看表详细信息describe
hbase(main):007:0> describe 'student'
Table student is ENABLED
student
COLUMN FAMILIES DESCRIPTION
{NAME => 'info', BLOOMFILTER => 'ROW', VERSIONS => '', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '', BLOCKCACHE => 'true', BLOCKSIZE => '', REPLICATION_SCOPE => ''}
1 row(s) in 0.1090 secondsNAME:列族名
BLOOMFILTER:布隆过滤器
VERSIONS:版本数,当前列族可以存多少版本
alter:修改某列族的信息:
# alter '表名',{NAME=>'列族名' ....}
# 比如:修改VERSION版本数
hbase(main):011:0> alter 'student',{NAME=>'info',VERSIONS=>3}
hbase(main):012:0> describe 'student' # 再次查看
{NAME => 'info', BLOOMFILTER => 'ROW', VERSIONS => '',....删除表,需要先disabled
# 删除表,需要先disabled,再drop
hbase(main):016:0> disable 'student'
hbase(main):017:0> drop 'student'
命名空间:
查看命名空间:list_namespace
hbase(main):019:0> list_namespace
NAMESPACE
default
hbase
2 row(s) in 0.0330 seconds创建命名空间:create_namespace '空间名'
hbase(main):020:0> create_namespace 'bigdata'
创建表到指定命名空间
hbase(main):022:0> create 'bigdata:student','info'
0 row(s) in 2.2200 seconds
=> Hbase::Table - bigdata:student删除命名空间:drop_namespace (必须是空的命名空间,要先删表)
hbase(main):023:0> disable 'bigdata:student'
0 row(s) in 2.2510 seconds
hbase(main):024:0> drop 'bigdata:student'
0 row(s) in 1.2370 seconds
hbase(main):026:0> drop_namespace 'bigdata'
0 row(s) in 0.8750 seconds
DML
put:增加,修改数据
# put '表名','RowKey','列族:列名','数据'
hbase(main):030:0> put 'test','','info1:name','zhangsan'scan:扫描查询(最大范围是查整个table)
# 注意:下面查询结果为3条数据
hbase(main):040:0> scan 'test'
ROW COLUMN+CELL
1001 column=info1:age, timestamp=1571381227061, value=17
1001 column=info1:name, timestamp=1571380877053, value=zhangsan
1001 column=info2:addr, timestamp=1571381241065, value=shanghai
1002 column=info1:age, timestamp=1571381266364, value=16
1002 column=info1:name, timestamp=1571381256744, value=lily
1002 column=info2:addr, timestamp=1571381276540, value=beijing
1003 column=info2:addr, timestamp=1571381290769, value=nanjing
3 row(s) in 0.0590 seconds
# 查看,左闭右开区间
hbase(main):044:0> scan 'test',{STARTROW=>'',ENDROW=>''}
# 查看,覆盖的版本,已经type
hbase(main):059:0> scan 'test',{RAW=>TRUE,VERSIONS=>3}
ROW COLUMN+CELL
1001 column=info1:age, timestamp=1571381227061, value=17
1001 column=info1:name, timestamp=1571382287224, type=DeleteColumn
1001 column=info1:name, timestamp=1571382179439, value=zhangsansan
1001 column=info1:name, timestamp=1571382130052, value=zhang
1001 column=info2:addr, timestamp=1571381241065, value=shanghai
1002 column=info1:age, timestamp=1571381266364, value=16
1002 column=info1:name, timestamp=1571381256744, value=lily
1002 column=info2:addr, timestamp=1571381276540, value=beijing
1003 column=info2:addr, timestamp=1571381290769, value=nanjingget:查询(最大范围是查RowKey)
# 查看一条数据,一个RowKey
hbase(main):041:0> get 'test',''
COLUMN CELL
info1:age timestamp=1571381227061, value=17
info1:name timestamp=1571380877053, value=zhangsan
info2:addr timestamp=1571381241065, value=shanghai
1 row(s) in 0.0050 seconds
# 查看某列
hbase(main):042:0> get 'test','','info1:name'
COLUMN CELL
info1:name timestamp=1571380877053, value=zhangsandelete:删除数据,在shell命令中必须指定到列,API中可以指定到列族
# 指定到列
hbase(main):054:0> delete 'test','','info1:name'alter:变更表信息
# 将info列族修改为可以存放3个版本
hbase(main):004:0> alter 'stu',{NAME=>'info',VERSIONS=>3}多版本查询
hbase(main):007:0> get 'stu','',{COLUMN=>'info:name',VERSIONS=>3}
COLUMN CELL
info:name timestamp=1571383299883, value=lucy
info:name timestamp=1571383293258, value=lily
【hbase】hbase的shell操作笔记的更多相关文章
- Hbase快速开始——shell操作
一. 介绍 HBase是一个分布式的.面向列的开源数据库,源于google的一篇论文<bigtable:一个结构化数据的分布式存储系统>.HBase是Google Bigtable的开源实 ...
- HBase(四)HBase集群Shell操作
一.进入HBase命令行 在你安装的随意台服务器节点上,执行命令:hbase shell,会进入到你的 hbase shell 客 户端 [admin@node21 ~]$ hbase shell S ...
- Hbase数据结构和shell操作
Hbase的数据结构 基本要素:命名空间.表.行.列.单元格,region,时间戳. 1.命名空间:NameSpaces的作用 Table:表,所有的表都是命名空间的成员,即表必属于某个命名空间,如果 ...
- HBase学习之路 (三)HBase集群Shell操作
进入HBase命令行 在你安装的随意台服务器节点上,执行命令:hbase shell,会进入到你的 hbase shell 客 户端 [hadoop@hadoop1 ~]$ hbase shell S ...
- Hbase(二)【shell操作】
目录 一.基础操作 1.进入shell命令行 2.帮助查看命令 二.命名空间操作 1.创建namespace 2.查看namespace 3.删除命名空间 三.表操作 1.查看所有表 2.创建表 3. ...
- Hbase的常见shell操作
1.带namespace的:https://blog.csdn.net/opensure/article/details/46470969 2.http://www.cnblogs.com/xing9 ...
- HBase学习笔记——配置及Shell操作
1.HBase的配置 还是以前配置的集群,见:http://www.cnblogs.com/DarrenChan/p/6493373.html 我们约定:weekend03和weekend04放HMa ...
- Hbase之shell操作
一. 介绍 HBase是一个分布式的.面向列的 开源数据库,源于google的一篇论文<bigtable:一个结构化数据的分布式存储系统>.HBase是Google Bigtable的开源 ...
- HBase(3)-安装与Shell操作
一. 安装 1. 启动Zookeeper集群 2. 启动Hadoop集群 3. 上传并解压HBase -bin.tar.gz -C /opt/module 4. 修改配置文件 #修改habse-env ...
随机推荐
- <div> <p> <span>的用法和区别
<div> 标签可以把文档分割为独立的.不同的部分.它可以用作严格的组织工具,并且不使用任何格式与其关联. 更重要的意义是在网页的动态实现过程中,对划分的区域统一处理,例如换背景色.字体等 ...
- Learning Face Age Progression: A Pyramid Architecture of GANs-1-实现人脸老化
Learning Face Age Progression: A Pyramid Architecture of GANs Abstract 人脸年龄发展有着两个重要的需求,即老化准确性和身份持久性, ...
- C语言 sscanf函数补充
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h&g ...
- [LeetCode] 68. Text Justification 文本对齐
Given an array of words and a length L, format the text such that each line has exactly L characters ...
- [LeetCode] 186. Reverse Words in a String II 翻转字符串中的单词 II
Given an input string, reverse the string word by word. A word is defined as a sequence of non-space ...
- [LeetCode] 500. Keyboard Row 键盘行
Given a List of words, return the words that can be typed using letters of alphabet on only one row' ...
- kubernetes之secret
Secret解决了密码.token.密钥等敏感数据的配置问题,而不需要把这些敏感数据暴露到镜像或者Pod Spec中.Secret可以以Volume或者环境变量的方式使用. Secret类型: Opa ...
- Appium UiWatchers 监听解决各种非期待弹窗,弹层,弹弹弹等问题
app自动化时,各种不期待的弹层弹窗,升级广告等时有飞出,由于弹窗具有不定时,不定页面等很多不确定性.有的弹窗很不友好,不×掉,很难进行下一步操作,造成 测试用例失败.而判断是否有弹窗,弹层很麻烦.研 ...
- TCP/IP学习笔记4--网络地址
"他强由他强,清风拂山岗.他横由他横,明月照大江.世间诸事,敞开心扉,顺其自然." -- 张大千 地址具有两个特性: 1:唯一性 同一个通信网络中的任意两个通信主体不能具有相同的地 ...
- [转帖]Linux教程(13)- Linux中的通配符和正则表达式
Linux教程(13)- Linux中的通配符和正则表达式 2018-08-22 06:16:44 钱婷婷 阅读数 39更多 分类专栏: Linux教程与操作 Linux教程与使用 版权声明:本文 ...