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 "Peter W." <pe...@marketingbrokers.com> on 2007/06/27 20:42:24 UTC

HBase sample

Hi,

Are there any HBase samples out there not using Junit?

I would like to:

a. create a master server, region and table descriptor.
b. read in and convert a 'csv' file to byte[] (populating a family  
with 3 columns).
c. get the data back out into Text format.

Also, are scanners required for getting values or can you
access the conceptual model with a labeled column directly?

Since data to recreate a table is in the csv, is logging required?

Thanks,

Peter W.

Re: HBase sample

Posted by "Peter W." <pe...@marketingbrokers.com>.
Thanks for the reply.

HClient methods look to be sufficient.

Regards,

Peter W.



On Jun 27, 2007, at 1:11 PM, Jim Kellerman wrote:

> I don't understand what you mean by "access the conceptual model  
> with a
> labelled column directly".
>
> However, you can either use a scanner if you want to iterate  
> through the
> table, or you can use one of the get methods to retrieve the value  
> for a
> particular row/column pair.


Re: HBase sample

Posted by Jim Kellerman <ji...@powerset.com>.
On Wed, 2007-06-27 at 12:50 -0700, Michael Stack wrote:
> Peter W. wrote:
> > c. get the data back out into Text format.
> Text result = new Text(client.get(row_name, column_name));
> 
> >
> > Also, are scanners required for getting values or can you
> > access the conceptual model with a labeled column directly?
> 
> Yes.

I don't understand what you mean by "access the conceptual model with a
labelled column directly".

However, you can either use a scanner if you want to iterate through the
table, or you can use one of the get methods to retrieve the value for a
particular row/column pair.

-- 
Jim Kellerman, Senior Engineer; Powerset
jim@powerset.com

Re: HBase sample

Posted by "Peter W." <pe...@marketingbrokers.com>.
Got them from the nightly build. It was my bad for not checking there  
first.

Thanks,

Peter W.


On Jun 28, 2007, at 2:19 PM, Michael Stack wrote:

> The scripts are in hadoop trunk.  They have not yet made it into an  
> official release.  (I'll adjust the documentation.)

Re: HBase sample

Posted by Michael Stack <st...@duboce.net>.
The scripts are in hadoop trunk.  They have not yet made it into an 
official release.  (I'll adjust the documentation.)
St.Ack

Peter W. wrote:
> Hi,
>
> The start-hbase.sh is mentioned on the wiki but
> is it included in the current Hadoop release?
>
> % ls -l hadoop-0.13.0/src/contrib/hbase/bin
> total 24
> -rw-rw-r--   1 manager  manager  6036 Jun  4 12:02 hbase
> -rw-rw-r--   1 manager  manager  1603 Jun  4 12:02 hbase-config.sh
>
> I was also curious if 127.0.0.1 can be a valid HServerAddress and is
> logging with HLog required.
>
> Thanks,
>
> Peter W.
>
>
> On Jun 27, 2007, at 12:50 PM, Michael Stack wrote:
>
>> Do you mean in code or on the command-line?  If the latter:
>>
>> > ${HBASE_HOME}/bin/start-hbase.sh
>> > ${HBASE_HOME}/bin/hbase client createTable table_name 
>> colum_family_name 3
>>
>> You may want/need to edit your 
>> ${HBASE_HOME}/conf/{hbase-env.sh,regionservers,hbase-site.xml} to 
>> suit your environment.
>
>
>>> Since data to recreate a table is in the csv, is logging required?
>>>
>> Which logging are you referring to?
>
>


Re: HBase sample

Posted by "Peter W." <pe...@marketingbrokers.com>.
Hi,

The start-hbase.sh is mentioned on the wiki but
is it included in the current Hadoop release?

% ls -l hadoop-0.13.0/src/contrib/hbase/bin
total 24
-rw-rw-r--   1 manager  manager  6036 Jun  4 12:02 hbase
-rw-rw-r--   1 manager  manager  1603 Jun  4 12:02 hbase-config.sh

I was also curious if 127.0.0.1 can be a valid HServerAddress and is
logging with HLog required.

Thanks,

Peter W.


On Jun 27, 2007, at 12:50 PM, Michael Stack wrote:

> Do you mean in code or on the command-line?  If the latter:
>
> > ${HBASE_HOME}/bin/start-hbase.sh
> > ${HBASE_HOME}/bin/hbase client createTable table_name  
> colum_family_name 3
>
> You may want/need to edit your ${HBASE_HOME}/conf/{hbase- 
> env.sh,regionservers,hbase-site.xml} to suit your environment.


>> Since data to recreate a table is in the csv, is logging required?
>>
> Which logging are you referring to?



Re: HBase sample

Posted by Michael Stack <st...@duboce.net>.
Peter W. wrote:
> Hi,
>
> Are there any HBase samples out there not using Junit?
Not currently.  The unit tests are good source for figuring how to 
manipulate hbase.  What else do you need?

> I would like to:
>
> a. create a master server, region and table descriptor.

Do you mean in code or on the command-line?  If the latter:

 > ${HBASE_HOME}/bin/start-hbase.sh
 > ${HBASE_HOME}/bin/hbase client createTable table_name colum_family_name 3

You may want/need to edit your 
${HBASE_HOME}/conf/{hbase-env.sh,regionservers,hbase-site.xml} to suit 
your environment.

> b. read in and convert a 'csv' file to byte[] (populating a family 
> with 3 columns).

For general pattern adding to a table goes as follows after creating a 
client instance:

      long lockid = client.startUpdate(row);
      client.put(lockid, column_name, value);
       ...
      client.commit(lockid);


> c. get the data back out into Text format.
Text result = new Text(client.get(row_name, column_name));

>
> Also, are scanners required for getting values or can you
> access the conceptual model with a labeled column directly?

Yes.
>
> Since data to recreate a table is in the csv, is logging required?
>
Which logging are you referring to?

Yours,
St.Ack

> Thanks,
>
> Peter W.