吴超老师课程--HBASE的查询手机项目
查询
1.按RowKey查询
2.按手机号码查询
3.按手机号码的区域查询
//查询手机13450456688的所有上网记录
public static void scan(String tableName) throws IOException{
HTable table = new HTable(getConfiguration(), tableName);
Scan scan = new Scan();
scan.setStartRow(Bytes.toBytes("13450456688:/"));
scan.setStopRow(Bytes.toBytes("13450456688::"));
ResultScanner scanner = table.getScanner(scan);
int i=0;
for (Result result : scanner) {
System.out.println("Scan: "+i+++" "+result);
}
}
//查询134号段的所有上网记录
public static void scanPeriod(String tableName) throws IOException{
HTable table = new HTable(getConfiguration(), tableName);
Scan scan = new Scan();
scan.setStartRow(Bytes.toBytes("134/"));
scan.setStopRow( Bytes.toBytes("134:"));
scan.setMaxVersions(1);
ResultScanner scanner = table.getScanner(scan);
int i=0;
for (Result result : scanner) {
System.out.println("Scan: "+i+++" "+result);
}
}
吴超老师课程--HBASE的查询手机项目的更多相关文章
- 吴超老师课程--Hbase介绍和伪分布式安装
1.HBase(NoSQL)的数据模型1.1 表(table),是存储管理数据的.1.2 行键(row key),类似于MySQL中的主键. 行键是HBase表天然自带的.1.3 列族(col ...
- 吴超老师课程--Hbase Shell
hbase提供了一个shell的终端给用户交互 名称 命令表达式 创建表 create '表名称', '列族名称1','列族名称2','列族名称N' 添加记录 put '表名称', '行名称', '列 ...
- 吴超老师课程--HBASE的Java_API
public static void main(String[] args) throws IOException { String tableName="hbase_tb"; S ...
- 吴超老师课程--HBASE的集群安装
1.hbase的机群搭建过程(在原来的hadoop上的hbase伪分布基础上进行搭建)1.1 集群结构,主节点(hmaster)是hadoop,从节点(region server)是hadoop1和h ...
- 吴超老师课程--Flume的安装和介绍
常用的分布式日志收集系统
- 吴超老师课程--Sqoop的安装和介绍
SQOOP是用于对数据进行导入导出的. (1)把MySQL.Oracle等数据库中的数据导入到HDFS.Hive.HBase中 (2)把HDFS.Hive.HBase中的数据导出到MySQ ...
- 吴超老师课程--Hive的执行语句
为什么选择Hive? (1)基于Hadoop的大数据的计算/扩展能力(2)支持SQL like查询语言(3)统一的元数据管理(4)简单编程 一:Hive的数据类型(1)基本数据类型tinyint/sm ...
- 吴超老师课程--Hive的介绍和安装
1.Hive1.1在hadoop生态圈中属于数据仓库的角色.他能够管理hadoop中的数据,同时可以查询hadoop中的数据. 本质上讲,hive是一个SQL解析引擎.Hive可以把SQL查询转换为 ...
- 吴超老师课程---ZooKeeper介绍和集群安装
1.ZooKeeper 1.1 zk可以用来保证数据在zk集群之间的数据的事务性一致.2.如何搭建ZooKeeper服务器集群 2.1 zk服务器集群规模不小于3个节点,要求各服务器之间系 ...
随机推荐
- OpenERP report doesn't work
1. When you have used OpenOffice edited one of reports,it has stored the report's banary data is da ...
- JVM Specification 9th Edition (4) Chapter 4. The class File Format
Chapter 4. The class File Format Table of Contents 4.1. The ClassFile Structure 4.2. Names 4.2.1. Bi ...
- 使用uGUI系统玩转标准俄罗斯方块
使用uGUI系统玩转标准俄罗斯方块 笔者使用的Unity3D版本是4.6b17.由于一些工作上的一些事情导致制作的进度被严重滞后.笔者实际用于开发俄罗斯方块的时间,大概也就2-3天吧. 开始前的准备 ...
- PHP——smarty模板(做登录页面和主页面)
denglu.php <?php include "init.inc.php"; $smarty->assign("action","ma ...
- python read文件内容的iter方式
遍历file的方式 iter(lambda: f.read(4096), "")等价与while True: data = f.read(4096) if not data: br ...
- python eval() hasattr() getattr() setattr() 函数使用方法详解
eval() 函数 --- 将字符串str当成有效的表达式来求值并返回计算结果. 语法:eval(source[, globals[, locals]]) ---> value 参数: sour ...
- Windows下RabbitMQ安装,部署,配置
安装部署 1.当前环境以及参考资料出处 部署环境:windows server 2008 r2 enterprise 官方安装部署文档:http://www.rabbitmq.com/install- ...
- sublime 空格 tab
sublime强大的编辑能力非常值得推荐.在编辑python语言时,因为python用段落格式取代了常见语言中的括号,所以在写python时.会将空格和tab混淆,如此产生的错误非常是恼人. 如17, ...
- convolutional neural network 课程笔记
一.CNN基础 (1)CNN在CV方面的应用 image classification(图像识别).object detection(目标检测).neural style transfer(风格迁移) ...
- CSS样式呈现优先级
经常出现CSS样式不生效的问题. 比如我先对p{},然后在其中一个标签写了个.p_style{}怎么都不生效,于是想到了CSS的呈现优先级. 经过自己测试, 属性style="" ...