简体   繁体   English

mapreduce,hbase和扫描

[英]mapreduce, hbase and scan

I have a MapReduce job that extends the TableMapper class. 我有一个扩展TableMapper类的MapReduce作业。 I use the TableMapperReduceUtil initTableMapperJob to setup the initial scan which works fine. 我使用TableMapperReduceUtil initTableMapperJob来设置可以正常工作的初始扫描。 Based on the rowkey retrieved from the Scan I want to run a Get (using a rowkey which is a value in the initial Scan row) on the same table within my MapReduce Map method. 基于从Scan检索到的行键,我想在MapReduce Map方法中的同一表上运行Get(使用行键,它是初始Scan行中的值)。 How do I access the Hbase connection to the same table from within the Map method? 如何从Map方法中访问与同一表的Hbase连接?

Probably you can create a new connection in this manner: 可能您可以通过以下方式创建新连接:

Configuration config = context.getConfiguration();
Connection conn = ConnectionFactory.createConnection(config);

But I think in your case it will be easier to use Spark on HBase 但是我认为在您的情况下, 在HBase上使用Spark会更容易

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM