Hi friends,
I am stuck with my development as I want my ruby client should interact with
REST interface to connect to Hbase. To attain this I installed
sishen-hbase-ruby gem and hbase-ruby gem on my Ubuntu box.
I tried to query a table present in Hbase using the following code but it is
giving error.
Code snippet :
require 'rubygems'
require 'hbase'
client = HBase::Client.new("http://localhost:8080/") # this url is
the default.
table = client.show_table('userstable') # show the meta
info of table users
Error on Console :
/usr/local/lib/ruby/gems/1.9.1/gems/sishen-hbase-ruby-1.0/lib/hbase/operation/table_operation.rb:9:in
`rescue in show_table': Table 'userstable' Not found
(HBase::TableNotFoundError)
from
/usr/local/lib/ruby/gems/1.9.1/gems/sishen-hbase-ruby-1.0/lib/hbase/operation/table_operation.rb:5:in
`show_table'
from /home/hadoop/Hbase_Script/Test.rb:10:in `<main>'
Error in Hbase Rest server logs :
2011-08-25 15:10:56,701 DEBUG
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation:
Cached location for .META.,,1.1028785192 is localhost:36169
2011-08-25 15:10:56,728 DEBUG org.apache.hadoop.hbase.rest.RowResource: GET
http://localhost:8080/api/userstable
2011-08-25 15:10:56,762 INFO org.apache.zookeeper.ZooKeeper: Initiating client
connection, connectString=localhost:2181 sessionTimeout=180000
watcher=hconnection
2011-08-25 15:10:56,765 INFO org.apache.zookeeper.ClientCnxn: Opening socket
connection to server localhost/10.33.100.107:2181
2011-08-25 15:10:56,765 INFO org.apache.zookeeper.ClientCnxn: Socket connection
established to localhost/10.33.100.107:2181, initiating session
2011-08-25 15:10:56,778 INFO org.apache.zookeeper.ClientCnxn: Session
establishment complete on server localhost/10.33.100.107:2181, sessionid =
0x131fc710262001f, negotiated timeout = 40000
2011-08-25 15:10:56,790 DEBUG
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation:
Lookedup root region location,
connection=org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@1acee78;
hsa=localhost:36169
2011-08-25 15:10:56,791 DEBUG
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation:
Cached location for .META.,,1.1028785192 is localhost:36169
2011-08-25 15:10:56,803 WARN
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation:
Encountered problems when prefetch META table:
org.apache.hadoop.hbase.TableNotFoundException: Cannot find row in .META. for
table: api, row=api,,99999999999999
at
org.apache.hadoop.hbase.client.MetaScanner.metaScan(MetaScanner.java:136)
at
org.apache.hadoop.hbase.client.MetaScanner.metaScan(MetaScanner.java:95)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.prefetchRegionCache(HConnectionManager.java:648)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:702)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:593)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:558)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:172)
........................
2011-08-25 15:10:56,807 ERROR org.mortbay.log: /api/userstable
java.lang.RuntimeException: org.apache.hadoop.hbase.TableNotFoundException: api
at
org.apache.hadoop.hbase.client.HTableFactory.createHTableInterface(HTableFactory.java:38)
at
org.apache.hadoop.hbase.client.HTablePool.createHTable(HTablePool.java:133)
at
org.apache.hadoop.hbase.client.HTablePool.getTable(HTablePool.java:89)
at
org.apache.hadoop.hbase.rest.RowResultGenerator.<init>(RowResultGenerator.java:49)
at
org.apache.hadoop.hbase.rest.ResultGenerator.fromRowSpec(ResultGenerator.java:35)
at org.apache.hadoop.hbase.rest.RowResource.get(RowResource.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
................
Caused by: org.apache.hadoop.hbase.TableNotFoundException: api
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:724)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:593)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:558)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:172)
at
org.apache.hadoop.hbase.client.HTableFactory.createHTableInterface(HTableFactory.java:36)
... 43 more
I am able to hit http://localhost:8080 from the browser and it gives me all the
tables present.I have no clue why it is adding /api/userstable in the url .
Please tell me how can I resolve it or if there is some other forum to which I
can point this issue.
Thanks
________________________________
::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates.
Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is
strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------