接上一篇,对hbase参数进行优化,主要是调整与查询效率相关的参数
count
select count(1) from hbase_table;
部分字段切表
insert overwrite table hive_table select a,b,c,d from hbase_table;
全字段切表
insert into table test_table partition(part='aa') select * from hbase_table;
hive至hive切表
create table test_table2 like test_table;
insert into table test_table2 partition(part) select * from test_table;
优化修改参数
<property>
<name>hbase.regionserver.handler.count</name>
<value>100</value>
<description>Count of RPC Listener instances spun up on RegionServers.
Same property is used by the Master for count of master handlers.
Default is 10.
</description>
</property>
<property>
<name>hfile.block.cache.size</name>
<value>0.4</value>
<description>
Percentage of maximum heap (-Xmx setting) to allocate to block cache
used by HFile/StoreFile. Default of 0.25 means allocate 25%.
Set to 0 to disable but it's not recommended.
</description>
</property>
<property>
<name>hbase.client.scanner.caching</name>
<value>1000</value>
<description>Number of rows that will be fetched when calling next
on a scanner if it is not served from (local, client) memory. Higher
caching values will enable faster scanners but will eat up more memory
and some calls of next may take longer and longer times when the cache is empty.
Do not set this value such that the time between invocations is greater
than the scanner timeout; i.e. hbase.regionserver.lease.period
</description>
</property>
切表
优化前后 | 字段全量与否 | case | 数据量 | cpu cost(minutes,seconds) | 执行cost(seconds) |
前 | 部分 | hbase->hive | 1616374 | 10 , 18 | 359.162 |
后 | 部分 | hbase->hive | 1616374 | 3 , 24 | 281.975 |
后 | 部分 | hbase->hive | 1616374 | 2 , 38 | 232.391 |
后 | 部分 | hbase->hive | 2608626 | 4 , 39 | 263.206 |
后 | 全量 | hbase->hive | 2608626 | 7 , 53 | 820.914 |
后 | 部分 | hbase->hive | 12230528 | 13 , 22 | 765.262 |
后 | 全量 | hbase->hive | 12230528 | 22 , 59 | 1305.236 |
后 | 全量 | hive->hive | 12230528 | 10 , 41 | 580.522 |
count
优化前后 | 表类型 | 数据量 | cpu cost(minutes,seconds) | 执行cost(seconds) |
优化前 | hbase | 1616374 | 10 , 45 | 728.647 |
| hive | 1616374 | 0 , 25 | 64.815 |
优化后 | hbase | 1616374 | 4 , 9 | 609.28 |
优化后 | hbase | 12230528 | 13 , 10 | 907.44 |
| hive | 12230528 | 3 , 18 | 422.138 |
总结
hive&hbase表的统计计算性能远低于hive表的统计计算,相差3倍乃至以上。
hbase参数优化前后有查询统计效率成倍提升,但与hive表相比也存在差距。
hive&hbase表切成hive表部分字段由于全量字段。
...
综上,hive的hbase存储结构不善于统计计算;hive表的hbase存储结构切换成hive普通的存储结构,随着数据量增加,性能也令人堪忧(如上测试也可以看到,即使是hive与hive表的切表数据量大也是很耗时的)。hbase方案具体是选择居于hive&hbase表统计计算,还是选择hive&hbase表切换成hive表后统计计算,需要权衡,或者是否有其他更好hive与hbase关联方案,需要继续研究。
分析:随着数据量越来越大,每天都进行hbase—>hive的切表,这是不切合实际的选择,但终究我们需要将hbase表转化成hive表,或许我们可以选择数据“冷热”、以及部分字段切表来优化。
备注:测试还不全面,待完善,特别是hive&hbase复杂sql的统计计算。
分享到:
相关推荐
被编译的hive-hbase-handler-1.2.1.jar,用于在Hive中创建关联HBase表的jar,解决创建Hive关联HBase时报FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. org.apache.hadoop....
配置,测试,导入数据详细操作,CREATE TABLE hive_hbase_table(key int, value string,name string) hadoop jar /usr/lib/hbase/hbase-0.90.4-cdh3u3.jar importtsv -Dimporttsv.columns=HBASE_ROW_KEY, catgyname...
hive和hbase整合的时候,如果出现不兼容的情况需要手动编译:hive-hbase-hander-1.2.2.jar把这个jar替换掉hive/lib里的那个jar包
由于大数据里面涉及到非关系型数据库如hive、kudu、hbase等的数据迁移,目前涉及到的迁移工具都没有支持hive数据库的事务表的迁移,如果hive库里面存在大量的事务表的时候,目前的工具都是不支持的,例如华为的CDM,...
HBase2.1.3整合Hive3.1.2,Hive官方的hive-hbase-handler-3.1.1.jar包不好用,自己编译后的,确认好用
hive0.8.1和hbase0.92.0集成的hive-hbase-handler.Jar包,里面包含:hbase-0.92.0.jar、hbase-0.92.0-tests.jar、hive-hbase-handler-0.9.0-SNAPSHOT.jar。经测试没有问题。
Hive与Hbase的整合,集中两者的优势,使用HiveQL语言,同时具备了实时性
hive和hbase的整合所需要的编译后的jar包。 注意:这里的hbase版本为:1.2.1 hive的版本为:1.2.1
大数据工具篇之Hive与HBase整合完整教程
该文档保护了目前比较流行的大数据平台的原理过程梳理。Hadoop,Hive,Hbase,Spark,MapReduce,Storm
hive0.10.0和hbase0.94.4集成的hive-hbase-handler.Jar包,经测试没有问题。
Hadoop Hive与Hbase整合配置
hive与hbase整合经验谈
Hive-1.2.1与HBase-1.3.1兼容处理的jar包 hive-hbase-handler-1.2.2.jar
基于hadoop的,java实现hive快速导数据到Hbase解决方案。
详细介绍了Hive,Hbase,MySQL的区别和优缺点分析
HIVE建表时可以指定映射关系直接读取HBASE的数据,相当于有了一个HBASE向HIVE的通道。那HIVE向HBASE有通道吗?本文主要讲述了Hive库数据如何入到HBASE中。
5、资源价值:大数据组件搭建的详细实践步骤、一次性提供较全面的常用大数据集群及组件安装部署内容、资源是博主结合官网文档+网上各类搭建文档+本人亲自实践后总结整合的文档(包括过程踩坑记录+对应解决方案)。