hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prasan Ary <voicesnthed...@yahoo.com>
Subject Re: problem connecting to Hbase for distributed operation
Date Sat, 16 Feb 2008 00:38:12 GMT
Stack,
  There are few things I still dont understand.
   
  When I create a new project in Eclipse workspace, I dont have the 'conf' directory in my
project folder. Is this something we create manually ?   And I am not editing hbase-site.xml
locally, rather this xml resides on a remote location that runs Hadoop and Hbase on Linux
machine.  I dont run Hadoop on my local XP machine. The way I connect to the remote Hadoop
server is through Hadoop-eclipse-plugin.jar which provides Mapreduce prespective in Eclipse,
among other things. I also have hadoop-0.16.0-hbase.jar and hadoop-0.16.0-core.jar donloaded
and referenced locally, so that any java code I write in Eclipse compiles correctly. Then
I use following code to connect:  
   
   
  HBaseConfiguration conf = new HBaseConfiguration();
  HBaseAdmin admin= new HBaseAdmin(conf);
  
  if( ! admin.tableExists(new Text(sTableName))) {
  HTableDescriptor desc = new HTableDescriptor(sTableName);
  desc.addFamily(new HColumnDescriptor("content:"));
  desc.addFamily(new HColumnDescriptor("anchor:"));
  desc.addFamily(new HColumnDescriptor("name:"));
  admin.createTable(desc);
  System.out.println("Table Created in " +( System.currentTimeMillis() - lStartTime) + " ms");
  }
  
  System.out.println("Inserting rows");
  lStartTime = System.currentTimeMillis();
  
  HTable table = new HTable(conf, new Text(sTableName));
  Random generator = new Random();
  Text row;
  long id;
  String data = " test data." ;
   
  id = table.startUpdate(row);
  table.put(id, new Text("content:"), ("content "+ data).getBytes(HConstants.UTF8_ENCODING));
  table.put(id, new Text("anchor:"), ("anchor "+ data).getBytes(HConstants.UTF8_ENCODING));
  table.put(id, new Text("name:"), ("name "+ data).getBytes(HConstants.UTF8_ENCODING));
  table.commit(id);
   
  
The code compiles correctly. 
   
   
   
   stack <stack@duboce.net> wrote:
  Its the local (windows) conf you need to get into your CLASSPATH. Edit 
the properties on your hbase project. Select 'java build path'. Click 
on the 'libraries' along the top. Hit the 'add class folder' button. 
Select the 'conf' dir that has the hbase-site.xml that you are editing. 
Attached is my .classpath so you can see what it looks like in the file 
when edit is done.
St.Ack


Prasan Ary wrote:
> Stack,
> 
> In Eclipse I checked Java > Build Path > Classpath Variables and I don't have an
entry for ${HBASE_HOME}/conf.
> 
> I'm not sure what value to put in here. I'm running eclipse v3.3 from a windows machine
and hadoop ( and hbase) runs on a linux machine over the network . Hadoop runs on "/hadoop"
and hbase runs on "/hadoop/contrib/hbase" on this linux machine.
> 
> V
> 
> stack wrote:
> What about answers to the other questions asked? Eclipse is not seeing 
> your hbase-site.xml changes. HBase is using defaults.
> St.Ack
>
> Prasan Ary wrote:
> 
>> Hi stack,
>> It is trying to connect to localhost . Follwoing is the error.
>> 08/02/15 15:25:59 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:60000.
Already tried 1 time(s).
>>
>> I restarted both hadoop and hbase after making changes to the xml file.
>>
>> stack wrote:
>> Whats the error? Is it trying to connect to localhost or what you've 
>> specified in hbase.master? Did you 'refresh' your project after the 
>> hbase-site.xml changes? Is the ${HBASE_HOME}/conf in your eclipse 
>> CLASSPATH?
>>
>> Hope this helps,
>> St.Ack
>>
>>
>> Prasan Ary wrote:
>>
>> 
>>> Hi all,
>>> I am using Java on Eclipse to connect to Hbase running on Hadoop 0.16.
>>>
>>> When Hbase is configured for standalone mode I have no problem connecting to
it. But when I switch to distributed mode and change the ${HBASE_HOME}/conf/hbase-site.xml
file to specify location of hbase.master , my java program fails to connect to hbase. But
at this point,however, I can run HQL queries on Hbase through the web-interface. Any idea
why Java fails to connect to hbase for distributed configuration ?
>>>
>>>
>>> Thanks,
>>> V.
>>>
>>>
>>> ---------------------------------
>>> Never miss a thing. Make Yahoo your homepage.
>>>
>>>
>>> 
>>
>>
>> ---------------------------------
>> Never miss a thing. Make Yahoo your homepage.
>>
>> 
>
>
>
> 
> ---------------------------------
> Never miss a thing. Make Yahoo your homepage.
> 





















































       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message