在Hbase表中使用Rowcounter [英] Using Rowcounter in Hbase table

查看:864
本文介绍了在Hbase表中使用Rowcounter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试计算Hbase表中的行数.可以用scannner做到这一点,但这是一个庞大的过程.想使用RowCounter从Hbase表中获取行号.有什么方法可以在Java代码中使用它.是否有任何示例或代码段可用. 通过使用命令:-

I am trying to calculate the no of rows in a Hbase table. Can do that with scannner but it is a bulky process.Want to use RowCounter to fetch the row number from Hbase table.Is there any way by which I can use that in Java Code. Is there any example or code snippet available. Directly using rowcounter is plain simple by using the command :-

    /hbase org.apache.hadoop.hbase.mapreduce.RowCounter [TABLE_NAME]

请提供任何代码段以在Java代码中使用相同的代码段.

Please provide any code snippet to use the same in Java code.

谢谢

推荐答案

您可以找到上述要获取行数,我们必须扫描hbase表.没有其他选择.但是,我们处理扫描的方式有所不同.上面的映射减少RowCounter,是在Hbase中获取行数的最快方法.由于map reduce并行工作,然后计数,因此我们得到了快速的结果.

To get the row count, we have to scan the hbase table. there is no other option. However, the way we handle the scan makes difference. The above map reduce RowCounter, is the fastest way to get the row count in Hbase. Since map reduce works in parallel, and then counts, we get fast results.

通过查看上面的源代码,您也可以自己进行操作,然后从其中删除不需要的内容.

You can do it, yourself too, by looking into the above source code, and remove unwanted thing from there.

此处,您可以找到有关API之间交互的API信息映射reduce和hbase

Here, you can find information about API provided for interaction between map reduce and hbase

这篇关于在Hbase表中使用Rowcounter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆