当前位置: 首页 > news >正文

做数独网站能挣钱吗/新闻投稿平台有哪些

做数独网站能挣钱吗,新闻投稿平台有哪些,2023b站免费推广网,微商货源类网站源码一、HBase 简介和应用场景 1.1 HBase 是什么? HBase 是什么?HBase 是在 Hadoop 分布式文件系统(简称:HDFS)之上的分布式面向列的数据库。而且是 2007 最初原型,历史悠久。 那追根究底,Hadoop…

一、HBase 简介和应用场景

1.1 HBase 是什么?

HBase 是什么?HBase 是在 Hadoop 分布式文件系统(简称:HDFS)之上的分布式面向列的数据库。而且是 2007 最初原型,历史悠久。

那追根究底,Hadoop 是什么?Hadoop是一个分布式环境存储并处理大数据。Hadoop 使用 MapReduce 算法统计分析大数据。这时候不得不说下 Google 的著名的三篇大数据的论文,分别讲述 GFS、MapReduce、BigTable,详见 https://www.bysocket.com/archives/2051。

那回到 HBase,HBase 在 Hadoop 之上提供了类似 BigTable 的能力,它不同于一般的关系数据库,是一个适合非结构化数据存储的数据库。它也不同于行式数据库,是基于列的模式。

HBase 一个面向列的数据库,排序由行决定。简而言之:

  • 表是行的集合。
  • 行是列族的集合。列族,就是键值对。每个列族以 key 为列命名,可以有无数的列。
  • 列族就是列的集合。列连续存储,并且每个单元会有对应的时间戳
  • 列的存储也是键值对。

image.png

与行式数据库最大的区别就是,可以面向列设计巨大表,适用于在线分析处理 OLAP。
与关系型数据库 RDBMS 也有些区别如下:

  • HBase 宽表,横向扩展。RDBMS 小表,难成规模
  • HBase 没有事务
  • HBase 无规范化数据,都是键值对 key value

1.2 HBase 应用场景

官网上 hbase.apache.org,特性这么多:

Features:
Linear and modular scalability.
Strictly consistent reads and writes.
Automatic and configurable sharding of tables
Automatic failover support between RegionServers.
Convenient base classes for backing Hadoop MapReduce jobs with Apache HBase tables.
Easy to use Java API for client access.
Block cache and Bloom Filters for real-time queries.
Query predicate push down via server side Filters
Thrift gateway and a REST-ful Web service that supports XML, Protobuf, and binary data encoding options
Extensible jruby-based (JIRB) shell
Support for exporting metrics via the Hadoop metrics subsystem to files or Ganglia; or via JMX

最主要的还是特性能有什么应用场景?大致搜集了下业界的:

  • 监控数据的日志详情
  • 交易订单的详情数据(淘宝、有赞)
  • facebook 的消息详情

二、spring-boot-starter-hbase 开源简介

spring-boot-starter-hbase 是自定义的spring-boot 的 hbase starter,为 hbase 的 query 和更新等操作提供简易的 api 并集成spring-boot 的 auto configuration。

具体地址:

https://github.com/SpringForAll/spring-boot-starter-hbase

三、集成 HBase 实战

具体代码地址:https://github.com/JeffLi1993/springboot-learning-example

工程名:springboot-hbase

3.1 安装 spring-boot-starter-hbase 组件依赖

官网给的sample也是xml方式,具体可以参考
https://github.com/spring-projects/spring-hadoop-samples/tree/master/hbase

在 pom.xml 文件中,引入相关依赖。 

<dependency><groupId>org.springframework.data</groupId><artifactId>spring-data-hadoop-hbase</artifactId><version>2.5.0.RELEASE</version></dependency><dependency><groupId>org.apache.hbase</groupId><artifactId>hbase-client</artifactId><version>2.1.2</version></dependency><dependency><groupId>org.springframework.data</groupId><artifactId>spring-data-hadoop</artifactId><version>2.5.0.RELEASE</version></dependency>

增加配置

官方提供的方式是通过xml方式,简单改写后如下:

@Configuration
public class HBaseConfiguration {@Value("${hbase.zookeeper.quorum}")private String zookeeperQuorum;@Value("${hbase.zookeeper.property.clientPort}")private String clientPort;@Value("${zookeeper.znode.parent}")private String znodeParent;@Beanpublic HbaseTemplate hbaseTemplate() {org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration();conf.set("hbase.zookeeper.quorum", zookeeperQuorum);conf.set("hbase.zookeeper.property.clientPort", clientPort);conf.set("zookeeper.znode.parent", znodeParent);return new HbaseTemplate(conf);}
}

application.yml 

hbase:zookeeper:quorum: hbase1.xxx.org,hbase2.xxx.org,hbase3.xxx.orgproperty:clientPort: 2181zookeeper:znode:parent: /hbase

 在service类注入HBaseTemplate

@Service
@Slf4j
public class HBaseService {@Autowiredprivate HbaseTemplate hbaseTemplate;public List<Result> getRowKeyAndColumn(String tableName, String startRowkey, String stopRowkey, String column, String qualifier) {FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL);if (StringUtils.isNotBlank(column)) {log.debug("{}", column);filterList.addFilter(new FamilyFilter(CompareFilter.CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes(column))));}if (StringUtils.isNotBlank(qualifier)) {log.debug("{}", qualifier);filterList.addFilter(new QualifierFilter(CompareFilter.CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes(qualifier))));}Scan scan = new Scan();if (filterList.getFilters().size() > 0) {scan.setFilter(filterList);}scan.setStartRow(Bytes.toBytes(startRowkey));scan.setStopRow(Bytes.toBytes(stopRowkey));return hbaseTemplate.find(tableName, scan, (rowMapper, rowNum) -> rowMapper);}public List<Result> getListRowkeyData(String tableName, List<String> rowKeys, String familyColumn, String column) {return rowKeys.stream().map(rk -> {if (StringUtils.isNotBlank(familyColumn)) {if (StringUtils.isNotBlank(column)) {return hbaseTemplate.get(tableName, rk, familyColumn, column, (rowMapper, rowNum) -> rowMapper);} else {return hbaseTemplate.get(tableName, rk, familyColumn, (rowMapper, rowNum) -> rowMapper);}}return hbaseTemplate.get(tableName, rk, (rowMapper, rowNum) -> rowMapper);}).collect(Collectors.toList());}
}

 

http://www.lbrq.cn/news/1259605.html

相关文章:

  • 做自己的网站/搭建网站平台
  • 做网站需要购买网站空间吗/seo教程下载
  • 广告公司需要办理什么资质/苏州优化收费
  • 建设银行网站证书/百度搜索词排名
  • 承德网站建设方案/整合营销包括哪三方面
  • 杭州网站制作推荐/化妆品营销推广方案
  • 临汾花果街网站建设/百度网盘搜索引擎入口在哪
  • 做虚拟币网站需要什么手续/互联网广告代理可靠吗
  • wordpress学校网站/网站技术解决方案
  • wordpress媒体库远程上传/资阳市网站seo
  • 做网站怎么发展客户/北京seo优化服务
  • 如何做自己的网站系统/网络推广精准营销推广
  • 杭州信贷网站制作/下载爱城市网app官方网站
  • 创办一个网站的流程/防疫管控优化措施
  • 网站相册源码/推广赚钱的软件
  • 那个网站有题做/seo博客写作
  • hexo 转 wordpress/宝鸡seo培训
  • 建设企业网站初始必备的六大功能/搜索引擎seo关键词优化
  • 网站做宣传域名什么好/网络整合营销是什么意思
  • 龙岩市新罗区疫情最新消息/徐州seo顾问
  • 做网站开发的经营范围/怎么搞自己的网站
  • 怎样给网站做后台/南宁百度seo排名优化
  • 专业做网站的团队推荐/长春网络优化最好的公司
  • 龙岗网站建设费用/广告联盟广告点击一次多少钱
  • 建设企业网站哪个好/查询网
  • wordpress 删除所有评论/营销型网站seo
  • DW做注册网站/seo入门书籍推荐
  • 快速建站平台源码/全自动引流推广软件免费
  • 定西营销型网站建设/广州广告公司
  • 网站后台配置/百度竞价推广自己可以做吗
  • 第二十四天(数据结构:栈和队列)队列实践请看下一篇
  • Java ++i 与 i++ 底层原理
  • Qt-vs加载exe图标
  • 专网内网IP攻击应急与防御方案
  • (FD Conv)Frequency Dynamic Convolution for Dense Image Prediction论文精读(逐段解析)
  • ubuntu apt安装与dpkg安装相互之间的关系