You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by ma qiang <ma...@gmail.com> on 2008/03/06 09:47:22 UTC

connection to HBase using HTable

Hi all:
     In my map function, I need to connect to a table in HBase several
times ,and I use HTable class, the code as belows:

          HTable TestConnection = new HTable(new HBaseConfiguration(),
new Text("test"));

So every time the map function run , the code must run ,and this run
time is waste.


Because of too many times of connection,the most part of time of run
time is waste in  new HTable().    So I want to run the code one time,
and all of task use the same connection. How can I do this?

RE: connection to HBase using HTable

Posted by Jim Kellerman <ji...@powerset.com>.
Take a look at the unit test TestTableMapReduce located in the
source tree under src/test/org/apache/hadoop/hbase/mapred

---
Jim Kellerman, Senior Engineer; Powerset


> -----Original Message-----
> From: ma qiang [mailto:maqiang1984@gmail.com]
> Sent: Thursday, March 06, 2008 12:47 AM
> To: core-user@hadoop.apache.org
> Subject: connection to HBase using HTable
>
> Hi all:
>      In my map function, I need to connect to a table in
> HBase several times ,and I use HTable class, the code as belows:
>
>           HTable TestConnection = new HTable(new
> HBaseConfiguration(), new Text("test"));
>
> So every time the map function run , the code must run ,and
> this run time is waste.
>
>
> Because of too many times of connection,the most part of time of run
> time is waste in  new HTable().    So I want to run the code one time,
> and all of task use the same connection. How can I do this?
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.21.4/1313 - Release
> Date: 3/5/2008 9:50 AM
>
>

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.4/1313 - Release Date: 3/5/2008 9:50 AM