Hbase shell基本操作
1、启动
cd <hbase_home>/bin
$ ./start-hbase.sh
2、启动hbase shell
# find hadoop-hbase dfs files
hadoop fs -ls /hbase
#start shell
hbase shell
#Run a command to verify that cluster is actually running#
list
3、logs配置
Change the default by editing <hbase_home>/conf/hbase-env.sh
export HBASE_LOG_DIR=/new/location/logs
4、后台管理
HBase comes with web based management
– http://localhost:60010
5、端口服务
Both Master and Region servers run web server
– Browsing Master will lead you to region servers
– Regions run on port 60030
6、基本命令
Quote all names
Table and column names
– Single quotes for text
• hbase> get 't1', 'myRowId'
– Double quotes for binary
• Use hexadecimal representation of that binary value
• hbase> get 't1', "key\x03\x3f\xcd"
Display cluster's status via status command
– hbase> status
– hbase> status 'detailed'
• Similar information can be found on HBase
Web Management Console
– http://localhost:60010
7、建表
Create Table
Create table called 'Blog' with the following
schema
– 2 families
–'info' with 3 columns: 'title', 'author', and 'date'
–'content' with 1 column family: 'post'
首先建立表,附带列族columns families
create 'Blog', {NAME=>'info'}, {NAME=>'content'}
然后,添加数据,注意hbase是基于rowkey的列数据库,可以一次添加一列或多列,必须每次添加指定rowkey
使用Put命令:
hbase> put 'table', 'row_id', 'family:column', 'value'
例子:
put 'Blog', 'Michelle-001', 'info:title', 'Michelle'
put 'Blog', 'Matt-001', 'info:author', 'Matt123'
put 'Blog', 'Matt-001', 'info:date', '2009.05.01'
put 'Blog', 'Matt-001', 'content:post', 'here is content'
列可以任意的扩展,比如
put 'Blog', 'Matt-001', 'content:news', 'news is new column'
8、查看数据-指定rowid
#查看数据库
count 'Blog'
count 'Blog', {INTERVAL=>2}
#查看行数据
get 'table', 'row_id'
get 'Blog', 'Matt-001'
get 'Blog', 'Matt-001',{COLUMN=>['info:author','content:post']}
#时间戳
get 'Blog', 'Michelle-004',{COLUMN=>['info:author','content:post'],TIMESTAMP=>1326061625690}
#版本
get 'Blog', 'Matt-001',{ VERSIONS=1}
get 'Blog', 'Matt-001',{COLUMN=>'info:date', VERSIONS=1}
get 'Blog', 'Matt-001',{COLUMN=>'info:date', VERSIONS>=2}
get 'Blog', 'Matt-001',{COLUMN=>'info:date'}
9、查看数据-通过scan指定范围,注意,所有的记录均按时间戳作为范围排序
Limit what columns are retrieved
– hbase> scan 'table', {COLUMNS=>['col1', 'col2']}
• Scan a time range
– hbase> scan 'table', {TIMERANGE => [1303, 13036]}
• Limit results with a filter
– hbase> scan 'Blog', {FILTER =>org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(1, 0)}
– More about filters later
scan 'Blog', {COLUMNS=>'info:title'}
开始于John,结束并排除Matt的
scan 'Blog', {COLUMNS=>'info:title',STARTROW=>'John', STOPROW=>'Matt'}
scan 'Blog', {COLUMNS=>'info:title', STOPROW=>'Matt'}
10、版本
put 'Blog', 'Michelle-004', 'info:date', '1990.07.06'
put 'Blog', 'Michelle-004', 'info:date', '1990.07.07'
put 'Blog', 'Michelle-004', 'info:date', '1990.07.08'
put 'Blog', 'Michelle-004', 'info:date', '1990.07.09'
get 'Blog', 'Michelle-004',{COLUMN=>'info:date', VERSIONS=>3}
11、Delete records
delete 'Blog', 'Bob-003', 'info:date'
12、Drop table
– Must disable before dropping
– puts the table “offline” so schema based operations can
be performed
– hbase> disable 'table_name'
– hbase> drop 'table_name'
Hbase shell基本操作的更多相关文章
- hbase shell 基本操作
hbase shell 基本操作 启动HBASE [hadoop@master ~]$hbase shell 2019-01-24 13:53:59,990 WARN [main] ut ...
- 大数据学习路线分享-Hbase shell的基本操作完整流程
HBase的命令行工具,最简单的接口,适合HBase管理使用,可以使用shell命令来查询HBase中数据的详细情况.安装完HBase之后,启动hadoop集群(利用hdfs存储),启动zookeep ...
- 关于HBase Shell命令基本操作示例
HBase 为用户提供了一个非常方便的使用方式, 我们称之为“HBase Shell”. HBase Shell 提供了大多数的 HBase 命令, 通过 HBase Shell 用户可以方便地创建. ...
- Hbase之shell基本操作
一.系统命令 启动hbase Shell ./bin/hbase shell 获取帮助 help 查询服务器状态 status 查询hbase版本 version 查询表 list 获取表描述 des ...
- hbase shell 基本命令总结
访问hbase,以及操作hbase,命令不用使用分号hbase shell 进入hbase list 查看表hbase shell -d hbase(main):024:0> scan '.ME ...
- Hbase Shell命令详解+API操作
HBase Shell 操作 3.1 基本操作1.进入 HBase 客户端命令行,在hbase-2.1.3目录下 bin/hbase shell 2.查看帮助命令 hbase(main):001:0& ...
- Hbase单机安装及使用hbase shell进行简单操作
一,配置环境变量 在etc/prifile中加入java环境变量及hbase环境变量: #set java environment JAVA_HOME=/usr/local/lhc/jdk1.8.0_ ...
- 大数据技术之_11_HBase学习_01_HBase 简介+HBase 安装+HBase Shell 操作+HBase 数据结构+HBase 原理
第1章 HBase 简介1.1 什么是 HBase1.2 HBase 特点1.3 HBase 架构1.3 HBase 中的角色1.3.1 HMaster1.3.2 RegionServer1.3.3 ...
- 云计算与大数据实验:Hbase shell基本命令操作
[实验目的] 1)了解hbase服务 2)学会启动和停止服务 3)学会进入hbase shell环境 [实验原理] HBase是一个分布式的.面向列的开源数据库,它利用Hadoop HDFS作为其文件 ...
随机推荐
- WD Elements 与 time machine
备份是很重要的问题. 之前买了一个 WD Elements,想要格式化成 HFS 的格式. 不然不能被 Time Machine 使用. 但是用磁盘工具不能成功,因为 EFI 分区的问题. 参考下面网 ...
- centos7源码安装heartbeat可能出现的错误以及解决办法
问题:ipmilan_command.c: In function 'setup_ipmi_conn':ipmilan_command.c:283:2: error: 'sel_alloc_selec ...
- AltiumDesigner 查找相似对象
同类器件的集体选中.集体选中的方法是:先选中一个标识符,右击在选项表中选择Find Similar Objects,然后就会出现一个对话框,在这个对话框中,有一些any项,根据自己的需要把一些any改 ...
- jsp中<c:if>标签的用法
<c:if test="${(tbl.column1 eq '值') and (tbl.column2 eq 'str')}"> <table>...< ...
- zabbix自定义监控
有的时候zabbix提供的监控项目,不能满足我们生产环境下的监控需求,此时我们就要按照zabbix的规范自定义监控项目,达到监控的目的 zabbix_get:模拟zabbix_server和agent ...
- 最近素数问题——C语言
从键盘输入一个整数,输出距离该数最近的素数 #include<stdio.h> #include<math.h> int judge(int x) { //判断素数 if (x ...
- osg探究补充:osg数据加载原理(插件机制简介)
前言 我们接着昨天的继续,昨天主要是讲解了DatabasePager类中的特定的成员变量以及run函数的第一部分,对所要请求加载的数据按照是否是网络数据进行分类加载模式.今天我们就看看数据是怎们加载到 ...
- NC 6系总账凭证联查原始单据
单据联查凭证可以找个如收款结算单的仿写一个. 而总账凭证联查单据则需要实现联查单据的类,重新写一个类.并把类注册进数据库. 最终效果: public class QuerySellcarryBillS ...
- zeromq学习记录(三)使用ZMQ_PULL ZMQ_PUSH
/************************************************************** 技术博客 http://www.cnblogs.com/itdef/ ...
- activeMq-1 快速入门
Activemq 是一款开源的消息中间件,适合中小型应用使用,遵循JMS规范. 具体介绍这里就不再阐述了,这里简单说下消息中间件的好处 1请求结果异步处理 客户端发送请求以后,服务器可以把相关数据放到 ...