You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Marco <ma...@gmail.com> on 2014/12/16 15:19:54 UTC

Cannot connect to Hbase via Java API

Hi,

Hbase is installed correctly and working (hbase shell works fine).

But I'm not able to use the Java API to connect to an existing Hbase Table:

<<<
val conf = HBaseConfiguration.create()

conf.clear()

conf.set("hbase.zookeeper.quorum", "ip:2181");
conf.set("hbase.zookeeper.property.clientPort", "2181");
conf.set("hbase.zookeeper.dns.nameserver", "ip");
conf.set("hbase.regionserver.port","60020");
conf.set("hbase.master", "ip:60000");

val hTable = new HTable(conf, "truck_events")

>>>

Actually the coding is Scala but I think it is understandable, what I
am trying to achieve. I've tried also to use hbase-site.xml instead of
manually configuring it -  but the result is the same.

As response I got
14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
connection, connectString=ip:2181 sessionTimeout=30000
watcher=hconnection
14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
to server ip:2181. Will not attempt to authenticate using SASL
(unknown error)
14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
established to ip:2181, initiating session
14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
timeout = 30000

and then finally after a couple of minutes: (the constructor call of
HTable is hanging)

[error] (run-main-0)
org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
find region for truck_events,,99999999999999 after 14 tries.
org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
find region for truck_events,,99999999999999 after 14 tries.
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
        at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
        at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
        at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
        at HbaseConnector$.main(HbaseConnector.scala:18)
        at HbaseConnector.main(HbaseConnector.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
[trace] Stack trace suppressed: run last compile:run for the full output.
14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
to interruption
java.lang.InterruptedException
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
        at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
        at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
java.lang.RuntimeException: Nonzero exit code: 1
        at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code: 1
[error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM


In the RegionServer log, I've seen this:

2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
ipc.RpcServer: RpcServer.listener,port=60020: connection from
10.97.68.159:41772; # active connections: 1
2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
10.97.68.159:41772 because read count=-1. Number of active
connections: 1
2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
evictedPerRun=0.0
2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
ipc.RpcServer: RpcServer.listener,port=60020: connection from
10.97.68.159:42728; # active connections: 1
2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
10.97.68.159:42728 because read count=-1. Number of active
connections: 1
2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
evictedPerRun=0.0

So it connects and disconnects with read count -1 .

Can anybody help me finding the root cause of this issue ? I've tried
to restart Hbase and so on but with no effect. Hive is also working
fine, just not my coding :(

Thanks a lot,
Marco

Re: Cannot connect to Hbase via Java API

Posted by Marco <ma...@gmail.com>.
Yes, that's all possible.

2014-12-18 14:12 GMT+01:00 Asher Devuyst <as...@gmail.com>:
> Are you able to put data to the table,  scan data from the table, and count
> the rows all  using the shell?
> You mentioned you could start the shell, but not that you had done any
> operations with it.  I would start there before using the api.
> On Dec 18, 2014 2:08 AM, "Marco" <ma...@gmail.com> wrote:
>
>> Ok, btw I've used "HDP 2.2 on Sandbox"
>>
>> 2014-12-18 4:19 GMT+01:00 Wilm Schumacher <wi...@gmail.com>:
>> > Am 17.12.2014 um 15:27 schrieb Marco:
>> >>> Tonight I will take a closer look at the sandbox (never
>> >>> used it before). Perhaps I'll find something. But there are some GB to
>> >>> download ;).
>> >> That would be cool :) Thx.
>> > *mumble curses*
>> >
>> > I cannot import the Hortenwork VM. VM-Import says the image is corrupt.
>> > But it could be that the download was interrupted. The file is too
>> > small. I'll re-download it and try tomorrow. FYI.
>> >
>> > Wilm
>>
>>
>>
>> --
>> Viele Grüße,
>> Marco
>>



-- 
Viele Grüße,
Marco

Re: Cannot connect to Hbase via Java API

Posted by Asher Devuyst <as...@gmail.com>.
Are you able to put data to the table,  scan data from the table, and count
the rows all  using the shell?
You mentioned you could start the shell, but not that you had done any
operations with it.  I would start there before using the api.
On Dec 18, 2014 2:08 AM, "Marco" <ma...@gmail.com> wrote:

> Ok, btw I've used "HDP 2.2 on Sandbox"
>
> 2014-12-18 4:19 GMT+01:00 Wilm Schumacher <wi...@gmail.com>:
> > Am 17.12.2014 um 15:27 schrieb Marco:
> >>> Tonight I will take a closer look at the sandbox (never
> >>> used it before). Perhaps I'll find something. But there are some GB to
> >>> download ;).
> >> That would be cool :) Thx.
> > *mumble curses*
> >
> > I cannot import the Hortenwork VM. VM-Import says the image is corrupt.
> > But it could be that the download was interrupted. The file is too
> > small. I'll re-download it and try tomorrow. FYI.
> >
> > Wilm
>
>
>
> --
> Viele Grüße,
> Marco
>

Re: Cannot connect to Hbase via Java API

Posted by Marco <ma...@gmail.com>.
Ok, btw I've used "HDP 2.2 on Sandbox"

2014-12-18 4:19 GMT+01:00 Wilm Schumacher <wi...@gmail.com>:
> Am 17.12.2014 um 15:27 schrieb Marco:
>>> Tonight I will take a closer look at the sandbox (never
>>> used it before). Perhaps I'll find something. But there are some GB to
>>> download ;).
>> That would be cool :) Thx.
> *mumble curses*
>
> I cannot import the Hortenwork VM. VM-Import says the image is corrupt.
> But it could be that the download was interrupted. The file is too
> small. I'll re-download it and try tomorrow. FYI.
>
> Wilm



-- 
Viele Grüße,
Marco

Re: Cannot connect to Hbase via Java API

Posted by Wilm Schumacher <wi...@gmail.com>.
Am 17.12.2014 um 15:27 schrieb Marco:
>> Tonight I will take a closer look at the sandbox (never
>> used it before). Perhaps I'll find something. But there are some GB to
>> download ;).
> That would be cool :) Thx.
*mumble curses*

I cannot import the Hortenwork VM. VM-Import says the image is corrupt.
But it could be that the download was interrupted. The file is too
small. I'll re-download it and try tomorrow. FYI.

Wilm

Re: Cannot connect to Hbase via Java API

Posted by Marco <ma...@gmail.com>.
>Tonight I will take a closer look at the sandbox (never
>used it before). Perhaps I'll find something. But there are some GB to
>download ;).

That would be cool :) Thx.


2014-12-17 14:56 GMT+01:00 Wilm Schumacher <wi...@gmail.com>:
> Am 17.12.2014 um 14:29 schrieb Marco:
>> Hi Wilm,
>>
>> the regionservers only contain the hostname.
> sounds good.
>
>>  And yes, I've changed the
>> name....hostname is consistent.
>>
>> ipV6 I could try but after searching for it, the issue seem to be
>> different (other excption).
>>
>> Also, I've installed hortonworks sandbox on my notebook and there I've
>> the same issue.
> strange O_o. Tonight I will take a closer look at the sandbox (never
> used it before). Perhaps I'll find something. But there are some GB to
> download ;).
>
>> Could it be a credential issue or sth in that direction? I also guess
>> I've no chance to debug it?
> sth? Did you mean ssh? And yes, passwdless ssh from the box to the box
> itself has to work, as you use hbase in distributed mode (nevertheless
> it's only a 1-node cluster). But in this case the ./bin/start-hbase.sh
> would have told you that there is a problem.
>
> However, this is very strange, as the hortenwork sandbox should work out
> of the box, isn't it?
>
> Best wishes,
>
> Wilm



-- 
Viele Grüße,
Marco

Re: Cannot connect to Hbase via Java API

Posted by Wilm Schumacher <wi...@gmail.com>.
Am 17.12.2014 um 14:29 schrieb Marco:
> Hi Wilm,
>
> the regionservers only contain the hostname.
sounds good.

>  And yes, I've changed the
> name....hostname is consistent.
>
> ipV6 I could try but after searching for it, the issue seem to be
> different (other excption).
>
> Also, I've installed hortonworks sandbox on my notebook and there I've
> the same issue.
strange O_o. Tonight I will take a closer look at the sandbox (never
used it before). Perhaps I'll find something. But there are some GB to
download ;).

> Could it be a credential issue or sth in that direction? I also guess
> I've no chance to debug it?
sth? Did you mean ssh? And yes, passwdless ssh from the box to the box
itself has to work, as you use hbase in distributed mode (nevertheless
it's only a 1-node cluster). But in this case the ./bin/start-hbase.sh
would have told you that there is a problem.

However, this is very strange, as the hortenwork sandbox should work out
of the box, isn't it?

Best wishes,

Wilm

Re: Cannot connect to Hbase via Java API

Posted by Marco <ma...@gmail.com>.
Hi Wilm,

the regionservers only contain the hostname. And yes, I've changed the
name....hostname is consistent.

ipV6 I could try but after searching for it, the issue seem to be
different (other excption).

Also, I've installed hortonworks sandbox on my notebook and there I've
the same issue.

Could it be a credential issue or sth in that direction? I also guess
I've no chance to debug it?

Anyways, thanks for your time,
Marco

2014-12-17 14:10 GMT+01:00 Wilm Schumacher <wi...@gmail.com>:
> Hi,
>
> I didn't found the content of the conf/regionservers files attached.
>
> Could you check whether it contains "localhost" or "host"/"myHost"? It
> should contain "host" or "myHost".
>
> Did you edit the content of the files for the attachment? Sometimes it
> is "myHost", sometimes it "host". This should be consistent.
>
> Furthermore I once read, that someone had a problem with ipv6 and hbase
> (thus all my installations does not use ipv6 ... just for safety).
> Perhaps you should turn that off and restart hadoop and hbase, too. Just
> as a test.
>
> And yes, it is strange that all the other stuff is working.
>
> Hope this helps,
>
> Wilm
>
> Am 17.12.2014 um 13:40 schrieb Marco:
>> Hi Wilm,
>>
>> I've attached the logs. The region server logs only contain debug
>> messages and mostly like the pattern, which I've pasted.
>> I'm using the HortonWorksStack and have a single machine, on which
>> runs the complete stack (no cluster).
>>
>> Hbase shell, Hive and Apache Phoenix works fine.
>>
>> BR Marco
>>
>> 2014-12-17 11:41 GMT+01:00 Wilm Schumacher <wi...@gmail.com>:
>>> Could you please post the
>>>
>>> /etc/hosts
>>> ./conf/hbase-site.conf
>>> ./conf/regionservers
>>> ./log/hbase*regionsserver.log
>>>
>>> ?
>>>
>>> The error says, that your regionserver is not running (or something
>>> happend with the server). This could mean, that
>>> a) the regionserver never started
>>> b) the regionserver died
>>> c) the regionserver is not available
>>> ...
>>>
>>> which could have many reasons. The strange thing is, that zookeeper
>>> seems to connect. So if you post the files from above, perhaps we can help.
>>>
>>> Best wishes,
>>>
>>> Wilm
>>>
>>> Am 16.12.2014 um 15:19 schrieb Marco:
>>>> Hi,
>>>>
>>>> Hbase is installed correctly and working (hbase shell works fine).
>>>>
>>>> But I'm not able to use the Java API to connect to an existing Hbase Table:
>>>>
>>>> <<<
>>>> val conf = HBaseConfiguration.create()
>>>>
>>>> conf.clear()
>>>>
>>>> conf.set("hbase.zookeeper.quorum", "ip:2181");
>>>> conf.set("hbase.zookeeper.property.clientPort", "2181");
>>>> conf.set("hbase.zookeeper.dns.nameserver", "ip");
>>>> conf.set("hbase.regionserver.port","60020");
>>>> conf.set("hbase.master", "ip:60000");
>>>>
>>>> val hTable = new HTable(conf, "truck_events")
>>>>
>>>> Actually the coding is Scala but I think it is understandable, what I
>>>> am trying to achieve. I've tried also to use hbase-site.xml instead of
>>>> manually configuring it -  but the result is the same.
>>>>
>>>> As response I got
>>>> 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
>>>> connection, connectString=ip:2181 sessionTimeout=30000
>>>> watcher=hconnection
>>>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
>>>> to server ip:2181. Will not attempt to authenticate using SASL
>>>> (unknown error)
>>>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
>>>> established to ip:2181, initiating session
>>>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
>>>> complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
>>>> timeout = 30000
>>>>
>>>> and then finally after a couple of minutes: (the constructor call of
>>>> HTable is hanging)
>>>>
>>>> [error] (run-main-0)
>>>> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>>>> find region for truck_events,,99999999999999 after 14 tries.
>>>> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>>>> find region for truck_events,,99999999999999 after 14 tries.
>>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
>>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
>>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
>>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
>>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
>>>>         at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
>>>>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
>>>>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
>>>>         at HbaseConnector$.main(HbaseConnector.scala:18)
>>>>         at HbaseConnector.main(HbaseConnector.scala)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>>> [trace] Stack trace suppressed: run last compile:run for the full output.
>>>> 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
>>>> to interruption
>>>> java.lang.InterruptedException
>>>>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
>>>>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
>>>>         at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
>>>>         at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
>>>> 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
>>>> java.lang.RuntimeException: Nonzero exit code: 1
>>>>         at scala.sys.package$.error(package.scala:27)
>>>> [trace] Stack trace suppressed: run last compile:run for the full output.
>>>> [error] (compile:run) Nonzero exit code: 1
>>>> [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
>>>>
>>>>
>>>> In the RegionServer log, I've seen this:
>>>>
>>>> 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
>>>> ipc.RpcServer: RpcServer.listener,port=60020: connection from
>>>> 10.97.68.159:41772; # active connections: 1
>>>> 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
>>>> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>>>> 10.97.68.159:41772 because read count=-1. Number of active
>>>> connections: 1
>>>> 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
>>>> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>>>> accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
>>>> cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
>>>> evictedPerRun=0.0
>>>> 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
>>>> ipc.RpcServer: RpcServer.listener,port=60020: connection from
>>>> 10.97.68.159:42728; # active connections: 1
>>>> 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
>>>> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>>>> 10.97.68.159:42728 because read count=-1. Number of active
>>>> connections: 1
>>>> 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
>>>> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>>>> accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
>>>> cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
>>>> evictedPerRun=0.0
>>>>
>>>> So it connects and disconnects with read count -1 .
>>>>
>>>> Can anybody help me finding the root cause of this issue ? I've tried
>>>> to restart Hbase and so on but with no effect. Hive is also working
>>>> fine, just not my coding :(
>>>>
>>>> Thanks a lot,
>>>> Marco
>>
>>
>



-- 
Viele Grüße,
Marco

Re: Cannot connect to Hbase via Java API

Posted by Wilm Schumacher <wi...@gmail.com>.
Hi,

I didn't found the content of the conf/regionservers files attached.

Could you check whether it contains "localhost" or "host"/"myHost"? It
should contain "host" or "myHost".

Did you edit the content of the files for the attachment? Sometimes it
is "myHost", sometimes it "host". This should be consistent.

Furthermore I once read, that someone had a problem with ipv6 and hbase
(thus all my installations does not use ipv6 ... just for safety).
Perhaps you should turn that off and restart hadoop and hbase, too. Just
as a test.

And yes, it is strange that all the other stuff is working.

Hope this helps,

Wilm

Am 17.12.2014 um 13:40 schrieb Marco:
> Hi Wilm,
>
> I've attached the logs. The region server logs only contain debug
> messages and mostly like the pattern, which I've pasted.
> I'm using the HortonWorksStack and have a single machine, on which
> runs the complete stack (no cluster).
>
> Hbase shell, Hive and Apache Phoenix works fine.
>
> BR Marco
>
> 2014-12-17 11:41 GMT+01:00 Wilm Schumacher <wi...@gmail.com>:
>> Could you please post the
>>
>> /etc/hosts
>> ./conf/hbase-site.conf
>> ./conf/regionservers
>> ./log/hbase*regionsserver.log
>>
>> ?
>>
>> The error says, that your regionserver is not running (or something
>> happend with the server). This could mean, that
>> a) the regionserver never started
>> b) the regionserver died
>> c) the regionserver is not available
>> ...
>>
>> which could have many reasons. The strange thing is, that zookeeper
>> seems to connect. So if you post the files from above, perhaps we can help.
>>
>> Best wishes,
>>
>> Wilm
>>
>> Am 16.12.2014 um 15:19 schrieb Marco:
>>> Hi,
>>>
>>> Hbase is installed correctly and working (hbase shell works fine).
>>>
>>> But I'm not able to use the Java API to connect to an existing Hbase Table:
>>>
>>> <<<
>>> val conf = HBaseConfiguration.create()
>>>
>>> conf.clear()
>>>
>>> conf.set("hbase.zookeeper.quorum", "ip:2181");
>>> conf.set("hbase.zookeeper.property.clientPort", "2181");
>>> conf.set("hbase.zookeeper.dns.nameserver", "ip");
>>> conf.set("hbase.regionserver.port","60020");
>>> conf.set("hbase.master", "ip:60000");
>>>
>>> val hTable = new HTable(conf, "truck_events")
>>>
>>> Actually the coding is Scala but I think it is understandable, what I
>>> am trying to achieve. I've tried also to use hbase-site.xml instead of
>>> manually configuring it -  but the result is the same.
>>>
>>> As response I got
>>> 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
>>> connection, connectString=ip:2181 sessionTimeout=30000
>>> watcher=hconnection
>>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
>>> to server ip:2181. Will not attempt to authenticate using SASL
>>> (unknown error)
>>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
>>> established to ip:2181, initiating session
>>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
>>> complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
>>> timeout = 30000
>>>
>>> and then finally after a couple of minutes: (the constructor call of
>>> HTable is hanging)
>>>
>>> [error] (run-main-0)
>>> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>>> find region for truck_events,,99999999999999 after 14 tries.
>>> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>>> find region for truck_events,,99999999999999 after 14 tries.
>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
>>>         at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
>>>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
>>>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
>>>         at HbaseConnector$.main(HbaseConnector.scala:18)
>>>         at HbaseConnector.main(HbaseConnector.scala)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>> [trace] Stack trace suppressed: run last compile:run for the full output.
>>> 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
>>> to interruption
>>> java.lang.InterruptedException
>>>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
>>>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
>>>         at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
>>>         at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
>>> 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
>>> java.lang.RuntimeException: Nonzero exit code: 1
>>>         at scala.sys.package$.error(package.scala:27)
>>> [trace] Stack trace suppressed: run last compile:run for the full output.
>>> [error] (compile:run) Nonzero exit code: 1
>>> [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
>>>
>>>
>>> In the RegionServer log, I've seen this:
>>>
>>> 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
>>> ipc.RpcServer: RpcServer.listener,port=60020: connection from
>>> 10.97.68.159:41772; # active connections: 1
>>> 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
>>> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>>> 10.97.68.159:41772 because read count=-1. Number of active
>>> connections: 1
>>> 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
>>> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>>> accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
>>> cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
>>> evictedPerRun=0.0
>>> 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
>>> ipc.RpcServer: RpcServer.listener,port=60020: connection from
>>> 10.97.68.159:42728; # active connections: 1
>>> 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
>>> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>>> 10.97.68.159:42728 because read count=-1. Number of active
>>> connections: 1
>>> 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
>>> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>>> accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
>>> cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
>>> evictedPerRun=0.0
>>>
>>> So it connects and disconnects with read count -1 .
>>>
>>> Can anybody help me finding the root cause of this issue ? I've tried
>>> to restart Hbase and so on but with no effect. Hive is also working
>>> fine, just not my coding :(
>>>
>>> Thanks a lot,
>>> Marco
>
>


Re: Cannot connect to Hbase via Java API

Posted by Marco <ma...@gmail.com>.
Hi Wilm,

I've attached the logs. The region server logs only contain debug
messages and mostly like the pattern, which I've pasted.
I'm using the HortonWorksStack and have a single machine, on which
runs the complete stack (no cluster).

Hbase shell, Hive and Apache Phoenix works fine.

BR Marco

2014-12-17 11:41 GMT+01:00 Wilm Schumacher <wi...@gmail.com>:
> Could you please post the
>
> /etc/hosts
> ./conf/hbase-site.conf
> ./conf/regionservers
> ./log/hbase*regionsserver.log
>
> ?
>
> The error says, that your regionserver is not running (or something
> happend with the server). This could mean, that
> a) the regionserver never started
> b) the regionserver died
> c) the regionserver is not available
> ...
>
> which could have many reasons. The strange thing is, that zookeeper
> seems to connect. So if you post the files from above, perhaps we can help.
>
> Best wishes,
>
> Wilm
>
> Am 16.12.2014 um 15:19 schrieb Marco:
>> Hi,
>>
>> Hbase is installed correctly and working (hbase shell works fine).
>>
>> But I'm not able to use the Java API to connect to an existing Hbase Table:
>>
>> <<<
>> val conf = HBaseConfiguration.create()
>>
>> conf.clear()
>>
>> conf.set("hbase.zookeeper.quorum", "ip:2181");
>> conf.set("hbase.zookeeper.property.clientPort", "2181");
>> conf.set("hbase.zookeeper.dns.nameserver", "ip");
>> conf.set("hbase.regionserver.port","60020");
>> conf.set("hbase.master", "ip:60000");
>>
>> val hTable = new HTable(conf, "truck_events")
>>
>> Actually the coding is Scala but I think it is understandable, what I
>> am trying to achieve. I've tried also to use hbase-site.xml instead of
>> manually configuring it -  but the result is the same.
>>
>> As response I got
>> 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
>> connection, connectString=ip:2181 sessionTimeout=30000
>> watcher=hconnection
>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
>> to server ip:2181. Will not attempt to authenticate using SASL
>> (unknown error)
>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
>> established to ip:2181, initiating session
>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
>> complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
>> timeout = 30000
>>
>> and then finally after a couple of minutes: (the constructor call of
>> HTable is hanging)
>>
>> [error] (run-main-0)
>> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>> find region for truck_events,,99999999999999 after 14 tries.
>> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>> find region for truck_events,,99999999999999 after 14 tries.
>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
>>         at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
>>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
>>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
>>         at HbaseConnector$.main(HbaseConnector.scala:18)
>>         at HbaseConnector.main(HbaseConnector.scala)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:606)
>> [trace] Stack trace suppressed: run last compile:run for the full output.
>> 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
>> to interruption
>> java.lang.InterruptedException
>>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
>>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
>>         at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
>>         at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
>> 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
>> java.lang.RuntimeException: Nonzero exit code: 1
>>         at scala.sys.package$.error(package.scala:27)
>> [trace] Stack trace suppressed: run last compile:run for the full output.
>> [error] (compile:run) Nonzero exit code: 1
>> [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
>>
>>
>> In the RegionServer log, I've seen this:
>>
>> 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
>> ipc.RpcServer: RpcServer.listener,port=60020: connection from
>> 10.97.68.159:41772; # active connections: 1
>> 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
>> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>> 10.97.68.159:41772 because read count=-1. Number of active
>> connections: 1
>> 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
>> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>> accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
>> cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
>> evictedPerRun=0.0
>> 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
>> ipc.RpcServer: RpcServer.listener,port=60020: connection from
>> 10.97.68.159:42728; # active connections: 1
>> 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
>> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>> 10.97.68.159:42728 because read count=-1. Number of active
>> connections: 1
>> 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
>> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>> accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
>> cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
>> evictedPerRun=0.0
>>
>> So it connects and disconnects with read count -1 .
>>
>> Can anybody help me finding the root cause of this issue ? I've tried
>> to restart Hbase and so on but with no effect. Hive is also working
>> fine, just not my coding :(
>>
>> Thanks a lot,
>> Marco
>



-- 
Viele Grüße,
Marco

Re: Cannot connect to Hbase via Java API

Posted by Wilm Schumacher <wi...@gmail.com>.
Could you please post the

/etc/hosts
./conf/hbase-site.conf
./conf/regionservers
./log/hbase*regionsserver.log

?

The error says, that your regionserver is not running (or something
happend with the server). This could mean, that
a) the regionserver never started
b) the regionserver died
c) the regionserver is not available
...

which could have many reasons. The strange thing is, that zookeeper
seems to connect. So if you post the files from above, perhaps we can help.

Best wishes,

Wilm

Am 16.12.2014 um 15:19 schrieb Marco:
> Hi,
>
> Hbase is installed correctly and working (hbase shell works fine).
>
> But I'm not able to use the Java API to connect to an existing Hbase Table:
>
> <<<
> val conf = HBaseConfiguration.create()
>
> conf.clear()
>
> conf.set("hbase.zookeeper.quorum", "ip:2181");
> conf.set("hbase.zookeeper.property.clientPort", "2181");
> conf.set("hbase.zookeeper.dns.nameserver", "ip");
> conf.set("hbase.regionserver.port","60020");
> conf.set("hbase.master", "ip:60000");
>
> val hTable = new HTable(conf, "truck_events")
>
> Actually the coding is Scala but I think it is understandable, what I
> am trying to achieve. I've tried also to use hbase-site.xml instead of
> manually configuring it -  but the result is the same.
>
> As response I got
> 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
> connection, connectString=ip:2181 sessionTimeout=30000
> watcher=hconnection
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
> to server ip:2181. Will not attempt to authenticate using SASL
> (unknown error)
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
> established to ip:2181, initiating session
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
> complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
> timeout = 30000
>
> and then finally after a couple of minutes: (the constructor call of
> HTable is hanging)
>
> [error] (run-main-0)
> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> find region for truck_events,,99999999999999 after 14 tries.
> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> find region for truck_events,,99999999999999 after 14 tries.
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
>         at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
>         at HbaseConnector$.main(HbaseConnector.scala:18)
>         at HbaseConnector.main(HbaseConnector.scala)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
> [trace] Stack trace suppressed: run last compile:run for the full output.
> 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
> to interruption
> java.lang.InterruptedException
>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
>         at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
>         at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
> 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
> java.lang.RuntimeException: Nonzero exit code: 1
>         at scala.sys.package$.error(package.scala:27)
> [trace] Stack trace suppressed: run last compile:run for the full output.
> [error] (compile:run) Nonzero exit code: 1
> [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
>
>
> In the RegionServer log, I've seen this:
>
> 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: connection from
> 10.97.68.159:41772; # active connections: 1
> 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> 10.97.68.159:41772 because read count=-1. Number of active
> connections: 1
> 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
> cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
> evictedPerRun=0.0
> 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: connection from
> 10.97.68.159:42728; # active connections: 1
> 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> 10.97.68.159:42728 because read count=-1. Number of active
> connections: 1
> 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
> cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
> evictedPerRun=0.0
>
> So it connects and disconnects with read count -1 .
>
> Can anybody help me finding the root cause of this issue ? I've tried
> to restart Hbase and so on but with no effect. Hive is also working
> fine, just not my coding :(
>
> Thanks a lot,
> Marco


Re: Cannot connect to Hbase via Java API

Posted by Marco <ma...@gmail.com>.
Hi,

the issue was that my Hbase client library did not fit to the server
version. Desperate ;) as I was, I switched on the debug log level and
have seen some messages, telling me that some node @ zookeeper would
be missing but that wouldn't be an error (?)...so that has looked
suspicious to me and I find an info that the protocol client<->server
has changed...then I've realized what the problem might be....

Maybe such incompatibilities could be better expressed in the log , don't know.

Anyways, all is running fine now :)

BR Marco

2014-12-18 20:36 GMT+01:00 Marco <ma...@gmail.com>:
> Hi Wilm,
>
> I also think, I'll try it with a hbase standalone install. Also via
> the logging of Apache Phoenix, I see that this framework can without
> any issues use the region server and it's the same hbase-site.xml.,.
>
> Nevertheless, thank you very much for your efforts!!!
>
> Best wishes,
> Marco
>
> 2014-12-18 17:43 GMT+01:00 Wilm Schumacher <wi...@gmail.com>:
>> Hi,
>>
>> I just took a look into the hdp 2.2 sandbox, and unfortunately it was a
>> waste of time and I went older ;).
>>
>> At the first boot, without me doing anything in the configs, zookeeper
>> throwed errors at startup and got killed (couldn't connect). However,
>> ignoring this I started hbase, which hdp recommend doing by hand O_o
>> (starting every service one by one). And the shell worked ... at first.
>>
>> Now I wanted to make it working and used a network bridge to ssh to the
>> box (copy jars for test programs etc.). And now hbase services didn't
>> want to start, because now it couldn't access the log files anymore
>> (missing permissions) *scratch at head*. I gave permissions to the hbase
>> user ... didn't work either. HMaster got killed immediately. After using
>> a host-only network ... same problems. I didn't looked further into the
>> problems, as I wanted to take only a small look at the product.
>>
>> After reimporting and a second try ... same problems. So, I couldn't
>> reproduce your problem because I didn't get to your point of problems :(.
>>
>> As this is a standard VM thousands of people use the errors are most
>> likely in my install of the VM, but it seems to be very easy to make
>> mistakes and end up with a not usable install :/. Sry that this didn't
>> help. But I think you should use a standard hbase standalone install to
>> test hbase for your purposes.
>>
>> Best wishes and good luck
>>
>> Wilm
>>
>> Am 16.12.2014 um 15:19 schrieb Marco:
>>> Hi,
>>>
>>> Hbase is installed correctly and working (hbase shell works fine).
>>>
>>> But I'm not able to use the Java API to connect to an existing Hbase Table:
>>>
>>> <<<
>>> val conf = HBaseConfiguration.create()
>>>
>>> conf.clear()
>>>
>>> conf.set("hbase.zookeeper.quorum", "ip:2181");
>>> conf.set("hbase.zookeeper.property.clientPort", "2181");
>>> conf.set("hbase.zookeeper.dns.nameserver", "ip");
>>> conf.set("hbase.regionserver.port","60020");
>>> conf.set("hbase.master", "ip:60000");
>>>
>>> val hTable = new HTable(conf, "truck_events")
>>>
>>> Actually the coding is Scala but I think it is understandable, what I
>>> am trying to achieve. I've tried also to use hbase-site.xml instead of
>>> manually configuring it -  but the result is the same.
>>>
>>> As response I got
>>> 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
>>> connection, connectString=ip:2181 sessionTimeout=30000
>>> watcher=hconnection
>>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
>>> to server ip:2181. Will not attempt to authenticate using SASL
>>> (unknown error)
>>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
>>> established to ip:2181, initiating session
>>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
>>> complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
>>> timeout = 30000
>>>
>>> and then finally after a couple of minutes: (the constructor call of
>>> HTable is hanging)
>>>
>>> [error] (run-main-0)
>>> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>>> find region for truck_events,,99999999999999 after 14 tries.
>>> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>>> find region for truck_events,,99999999999999 after 14 tries.
>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
>>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
>>>         at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
>>>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
>>>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
>>>         at HbaseConnector$.main(HbaseConnector.scala:18)
>>>         at HbaseConnector.main(HbaseConnector.scala)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>         at java.lang.reflect.Method.invoke(Method.java:606)
>>> [trace] Stack trace suppressed: run last compile:run for the full output.
>>> 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
>>> to interruption
>>> java.lang.InterruptedException
>>>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
>>>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
>>>         at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
>>>         at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
>>> 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
>>> java.lang.RuntimeException: Nonzero exit code: 1
>>>         at scala.sys.package$.error(package.scala:27)
>>> [trace] Stack trace suppressed: run last compile:run for the full output.
>>> [error] (compile:run) Nonzero exit code: 1
>>> [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
>>>
>>>
>>> In the RegionServer log, I've seen this:
>>>
>>> 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
>>> ipc.RpcServer: RpcServer.listener,port=60020: connection from
>>> 10.97.68.159:41772; # active connections: 1
>>> 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
>>> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>>> 10.97.68.159:41772 because read count=-1. Number of active
>>> connections: 1
>>> 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
>>> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>>> accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
>>> cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
>>> evictedPerRun=0.0
>>> 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
>>> ipc.RpcServer: RpcServer.listener,port=60020: connection from
>>> 10.97.68.159:42728; # active connections: 1
>>> 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
>>> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>>> 10.97.68.159:42728 because read count=-1. Number of active
>>> connections: 1
>>> 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
>>> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>>> accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
>>> cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
>>> evictedPerRun=0.0
>>>
>>> So it connects and disconnects with read count -1 .
>>>
>>> Can anybody help me finding the root cause of this issue ? I've tried
>>> to restart Hbase and so on but with no effect. Hive is also working
>>> fine, just not my coding :(
>>>
>>> Thanks a lot,
>>> Marco
>>
>
>
>
> --
> Viele Grüße,
> Marco



-- 
Viele Grüße,
Marco

Re: Cannot connect to Hbase via Java API

Posted by Marco <ma...@gmail.com>.
Hi Wilm,

I also think, I'll try it with a hbase standalone install. Also via
the logging of Apache Phoenix, I see that this framework can without
any issues use the region server and it's the same hbase-site.xml.,.

Nevertheless, thank you very much for your efforts!!!

Best wishes,
Marco

2014-12-18 17:43 GMT+01:00 Wilm Schumacher <wi...@gmail.com>:
> Hi,
>
> I just took a look into the hdp 2.2 sandbox, and unfortunately it was a
> waste of time and I went older ;).
>
> At the first boot, without me doing anything in the configs, zookeeper
> throwed errors at startup and got killed (couldn't connect). However,
> ignoring this I started hbase, which hdp recommend doing by hand O_o
> (starting every service one by one). And the shell worked ... at first.
>
> Now I wanted to make it working and used a network bridge to ssh to the
> box (copy jars for test programs etc.). And now hbase services didn't
> want to start, because now it couldn't access the log files anymore
> (missing permissions) *scratch at head*. I gave permissions to the hbase
> user ... didn't work either. HMaster got killed immediately. After using
> a host-only network ... same problems. I didn't looked further into the
> problems, as I wanted to take only a small look at the product.
>
> After reimporting and a second try ... same problems. So, I couldn't
> reproduce your problem because I didn't get to your point of problems :(.
>
> As this is a standard VM thousands of people use the errors are most
> likely in my install of the VM, but it seems to be very easy to make
> mistakes and end up with a not usable install :/. Sry that this didn't
> help. But I think you should use a standard hbase standalone install to
> test hbase for your purposes.
>
> Best wishes and good luck
>
> Wilm
>
> Am 16.12.2014 um 15:19 schrieb Marco:
>> Hi,
>>
>> Hbase is installed correctly and working (hbase shell works fine).
>>
>> But I'm not able to use the Java API to connect to an existing Hbase Table:
>>
>> <<<
>> val conf = HBaseConfiguration.create()
>>
>> conf.clear()
>>
>> conf.set("hbase.zookeeper.quorum", "ip:2181");
>> conf.set("hbase.zookeeper.property.clientPort", "2181");
>> conf.set("hbase.zookeeper.dns.nameserver", "ip");
>> conf.set("hbase.regionserver.port","60020");
>> conf.set("hbase.master", "ip:60000");
>>
>> val hTable = new HTable(conf, "truck_events")
>>
>> Actually the coding is Scala but I think it is understandable, what I
>> am trying to achieve. I've tried also to use hbase-site.xml instead of
>> manually configuring it -  but the result is the same.
>>
>> As response I got
>> 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
>> connection, connectString=ip:2181 sessionTimeout=30000
>> watcher=hconnection
>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
>> to server ip:2181. Will not attempt to authenticate using SASL
>> (unknown error)
>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
>> established to ip:2181, initiating session
>> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
>> complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
>> timeout = 30000
>>
>> and then finally after a couple of minutes: (the constructor call of
>> HTable is hanging)
>>
>> [error] (run-main-0)
>> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>> find region for truck_events,,99999999999999 after 14 tries.
>> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>> find region for truck_events,,99999999999999 after 14 tries.
>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
>>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
>>         at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
>>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
>>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
>>         at HbaseConnector$.main(HbaseConnector.scala:18)
>>         at HbaseConnector.main(HbaseConnector.scala)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:606)
>> [trace] Stack trace suppressed: run last compile:run for the full output.
>> 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
>> to interruption
>> java.lang.InterruptedException
>>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
>>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
>>         at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
>>         at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
>> 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
>> java.lang.RuntimeException: Nonzero exit code: 1
>>         at scala.sys.package$.error(package.scala:27)
>> [trace] Stack trace suppressed: run last compile:run for the full output.
>> [error] (compile:run) Nonzero exit code: 1
>> [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
>>
>>
>> In the RegionServer log, I've seen this:
>>
>> 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
>> ipc.RpcServer: RpcServer.listener,port=60020: connection from
>> 10.97.68.159:41772; # active connections: 1
>> 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
>> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>> 10.97.68.159:41772 because read count=-1. Number of active
>> connections: 1
>> 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
>> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>> accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
>> cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
>> evictedPerRun=0.0
>> 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
>> ipc.RpcServer: RpcServer.listener,port=60020: connection from
>> 10.97.68.159:42728; # active connections: 1
>> 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
>> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>> 10.97.68.159:42728 because read count=-1. Number of active
>> connections: 1
>> 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
>> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>> accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
>> cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
>> evictedPerRun=0.0
>>
>> So it connects and disconnects with read count -1 .
>>
>> Can anybody help me finding the root cause of this issue ? I've tried
>> to restart Hbase and so on but with no effect. Hive is also working
>> fine, just not my coding :(
>>
>> Thanks a lot,
>> Marco
>



-- 
Viele Grüße,
Marco

Re: Cannot connect to Hbase via Java API

Posted by Wilm Schumacher <wi...@gmail.com>.
Hi,

I just took a look into the hdp 2.2 sandbox, and unfortunately it was a
waste of time and I went older ;).

At the first boot, without me doing anything in the configs, zookeeper
throwed errors at startup and got killed (couldn't connect). However,
ignoring this I started hbase, which hdp recommend doing by hand O_o
(starting every service one by one). And the shell worked ... at first.

Now I wanted to make it working and used a network bridge to ssh to the
box (copy jars for test programs etc.). And now hbase services didn't
want to start, because now it couldn't access the log files anymore
(missing permissions) *scratch at head*. I gave permissions to the hbase
user ... didn't work either. HMaster got killed immediately. After using
a host-only network ... same problems. I didn't looked further into the
problems, as I wanted to take only a small look at the product.

After reimporting and a second try ... same problems. So, I couldn't
reproduce your problem because I didn't get to your point of problems :(.

As this is a standard VM thousands of people use the errors are most
likely in my install of the VM, but it seems to be very easy to make
mistakes and end up with a not usable install :/. Sry that this didn't
help. But I think you should use a standard hbase standalone install to
test hbase for your purposes.

Best wishes and good luck

Wilm

Am 16.12.2014 um 15:19 schrieb Marco:
> Hi,
>
> Hbase is installed correctly and working (hbase shell works fine).
>
> But I'm not able to use the Java API to connect to an existing Hbase Table:
>
> <<<
> val conf = HBaseConfiguration.create()
>
> conf.clear()
>
> conf.set("hbase.zookeeper.quorum", "ip:2181");
> conf.set("hbase.zookeeper.property.clientPort", "2181");
> conf.set("hbase.zookeeper.dns.nameserver", "ip");
> conf.set("hbase.regionserver.port","60020");
> conf.set("hbase.master", "ip:60000");
>
> val hTable = new HTable(conf, "truck_events")
>
> Actually the coding is Scala but I think it is understandable, what I
> am trying to achieve. I've tried also to use hbase-site.xml instead of
> manually configuring it -  but the result is the same.
>
> As response I got
> 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
> connection, connectString=ip:2181 sessionTimeout=30000
> watcher=hconnection
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
> to server ip:2181. Will not attempt to authenticate using SASL
> (unknown error)
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
> established to ip:2181, initiating session
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
> complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
> timeout = 30000
>
> and then finally after a couple of minutes: (the constructor call of
> HTable is hanging)
>
> [error] (run-main-0)
> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> find region for truck_events,,99999999999999 after 14 tries.
> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> find region for truck_events,,99999999999999 after 14 tries.
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
>         at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
>         at HbaseConnector$.main(HbaseConnector.scala:18)
>         at HbaseConnector.main(HbaseConnector.scala)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
> [trace] Stack trace suppressed: run last compile:run for the full output.
> 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
> to interruption
> java.lang.InterruptedException
>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
>         at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
>         at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
> 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
> java.lang.RuntimeException: Nonzero exit code: 1
>         at scala.sys.package$.error(package.scala:27)
> [trace] Stack trace suppressed: run last compile:run for the full output.
> [error] (compile:run) Nonzero exit code: 1
> [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
>
>
> In the RegionServer log, I've seen this:
>
> 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: connection from
> 10.97.68.159:41772; # active connections: 1
> 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> 10.97.68.159:41772 because read count=-1. Number of active
> connections: 1
> 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
> cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
> evictedPerRun=0.0
> 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: connection from
> 10.97.68.159:42728; # active connections: 1
> 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> 10.97.68.159:42728 because read count=-1. Number of active
> connections: 1
> 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
> cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
> evictedPerRun=0.0
>
> So it connects and disconnects with read count -1 .
>
> Can anybody help me finding the root cause of this issue ? I've tried
> to restart Hbase and so on but with no effect. Hive is also working
> fine, just not my coding :(
>
> Thanks a lot,
> Marco


Re: Cannot connect to Hbase via Java API

Posted by anil gupta <an...@gmail.com>.
Hi Marco,

Did you make sure that hbase-site.xml is present the classpath of your java
app? As per your error, it looks like thats not the case.

Thanks,
Anil

On Tue, Dec 16, 2014 at 10:29 AM, Marco <ma...@gmail.com> wrote:
>
> I tried it also completely without setting the config manually,
>
> so just
>
>  val conf = HBaseConfiguration.create()
>
> directly on the server, where hbase/hadoop etc. is installed. Same
> issue....I guess there is no connection issue but an issue with the
> region server (?)
> Understanding what exactly the exception means would be a first step, I
> guess.
>
> I've tried Apache Phoenix also and that works so it could not be a
> general issue with my Hbase/Hadoop config, I guess.
>
> 2014-12-16 17:06 GMT+01:00 Ted Yu <yu...@gmail.com>:
> > bq. conf.clear()
> >
> > Why is the above needed ?
> > Try removing it.
> >
> > Cheers
> >
> > On Tue, Dec 16, 2014 at 7:57 AM, Marco <ma...@gmail.com> wrote:
> >>
> >> no effect :(
> >>
> >> 2014-12-16 15:19 GMT+01:00 Marco <ma...@gmail.com>:
> >> > Hi,
> >> >
> >> > Hbase is installed correctly and working (hbase shell works fine).
> >> >
> >> > But I'm not able to use the Java API to connect to an existing Hbase
> >> Table:
> >> >
> >> > <<<
> >> > val conf = HBaseConfiguration.create()
> >> >
> >> > conf.clear()
> >> >
> >> > conf.set("hbase.zookeeper.quorum", "ip:2181");
> >> > conf.set("hbase.zookeeper.property.clientPort", "2181");
> >> > conf.set("hbase.zookeeper.dns.nameserver", "ip");
> >> > conf.set("hbase.regionserver.port","60020");
> >> > conf.set("hbase.master", "ip:60000");
> >> >
> >> > val hTable = new HTable(conf, "truck_events")
> >> >
> >> >>>>
> >> >
> >> > Actually the coding is Scala but I think it is understandable, what I
> >> > am trying to achieve. I've tried also to use hbase-site.xml instead of
> >> > manually configuring it -  but the result is the same.
> >> >
> >> > As response I got
> >> > 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
> >> > connection, connectString=ip:2181 sessionTimeout=30000
> >> > watcher=hconnection
> >> > 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
> >> > to server ip:2181. Will not attempt to authenticate using SASL
> >> > (unknown error)
> >> > 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
> >> > established to ip:2181, initiating session
> >> > 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
> >> > complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
> >> > timeout = 30000
> >> >
> >> > and then finally after a couple of minutes: (the constructor call of
> >> > HTable is hanging)
> >> >
> >> > [error] (run-main-0)
> >> > org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> >> > find region for truck_events,,99999999999999 after 14 tries.
> >> > org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> >> > find region for truck_events,,99999999999999 after 14 tries.
> >> >         at
> >>
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
> >> >         at
> >>
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
> >> >         at
> >>
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
> >> >         at
> >>
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
> >> >         at
> >>
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
> >> >         at
> >> org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
> >> >         at
> org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
> >> >         at
> org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
> >> >         at HbaseConnector$.main(HbaseConnector.scala:18)
> >> >         at HbaseConnector.main(HbaseConnector.scala)
> >> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> >         at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >> >         at
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> >         at java.lang.reflect.Method.invoke(Method.java:606)
> >> > [trace] Stack trace suppressed: run last compile:run for the full
> output.
> >> > 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
> >> > to interruption
> >> > java.lang.InterruptedException
> >> >         at
> >>
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
> >> >         at
> >>
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
> >> >         at
> >>
> java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
> >> >         at
> >> org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
> >> > 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
> >> > java.lang.RuntimeException: Nonzero exit code: 1
> >> >         at scala.sys.package$.error(package.scala:27)
> >> > [trace] Stack trace suppressed: run last compile:run for the full
> output.
> >> > [error] (compile:run) Nonzero exit code: 1
> >> > [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
> >> >
> >> >
> >> > In the RegionServer log, I've seen this:
> >> >
> >> > 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
> >> > ipc.RpcServer: RpcServer.listener,port=60020: connection from
> >> > 10.97.68.159:41772; # active connections: 1
> >> > 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
> >> > ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> >> > 10.97.68.159:41772 because read count=-1. Number of active
> >> > connections: 1
> >> > 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
> >> > Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> >> > accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
> >> > cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
> >> > evictedPerRun=0.0
> >> > 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
> >> > ipc.RpcServer: RpcServer.listener,port=60020: connection from
> >> > 10.97.68.159:42728; # active connections: 1
> >> > 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
> >> > ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> >> > 10.97.68.159:42728 because read count=-1. Number of active
> >> > connections: 1
> >> > 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
> >> > Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> >> > accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
> >> > cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
> >> > evictedPerRun=0.0
> >> >
> >> > So it connects and disconnects with read count -1 .
> >> >
> >> > Can anybody help me finding the root cause of this issue ? I've tried
> >> > to restart Hbase and so on but with no effect. Hive is also working
> >> > fine, just not my coding :(
> >> >
> >> > Thanks a lot,
> >> > Marco
> >>
> >>
> >>
> >> --
> >> Viele Grüße,
> >> Marco
> >>
>
>
>
> --
> Viele Grüße,
> Marco
>


-- 
Thanks & Regards,
Anil Gupta

Re: Cannot connect to Hbase via Java API

Posted by Marco <ma...@gmail.com>.
I tried it also completely without setting the config manually,

so just

 val conf = HBaseConfiguration.create()

directly on the server, where hbase/hadoop etc. is installed. Same
issue....I guess there is no connection issue but an issue with the
region server (?)
Understanding what exactly the exception means would be a first step, I guess.

I've tried Apache Phoenix also and that works so it could not be a
general issue with my Hbase/Hadoop config, I guess.

2014-12-16 17:06 GMT+01:00 Ted Yu <yu...@gmail.com>:
> bq. conf.clear()
>
> Why is the above needed ?
> Try removing it.
>
> Cheers
>
> On Tue, Dec 16, 2014 at 7:57 AM, Marco <ma...@gmail.com> wrote:
>>
>> no effect :(
>>
>> 2014-12-16 15:19 GMT+01:00 Marco <ma...@gmail.com>:
>> > Hi,
>> >
>> > Hbase is installed correctly and working (hbase shell works fine).
>> >
>> > But I'm not able to use the Java API to connect to an existing Hbase
>> Table:
>> >
>> > <<<
>> > val conf = HBaseConfiguration.create()
>> >
>> > conf.clear()
>> >
>> > conf.set("hbase.zookeeper.quorum", "ip:2181");
>> > conf.set("hbase.zookeeper.property.clientPort", "2181");
>> > conf.set("hbase.zookeeper.dns.nameserver", "ip");
>> > conf.set("hbase.regionserver.port","60020");
>> > conf.set("hbase.master", "ip:60000");
>> >
>> > val hTable = new HTable(conf, "truck_events")
>> >
>> >>>>
>> >
>> > Actually the coding is Scala but I think it is understandable, what I
>> > am trying to achieve. I've tried also to use hbase-site.xml instead of
>> > manually configuring it -  but the result is the same.
>> >
>> > As response I got
>> > 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
>> > connection, connectString=ip:2181 sessionTimeout=30000
>> > watcher=hconnection
>> > 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
>> > to server ip:2181. Will not attempt to authenticate using SASL
>> > (unknown error)
>> > 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
>> > established to ip:2181, initiating session
>> > 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
>> > complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
>> > timeout = 30000
>> >
>> > and then finally after a couple of minutes: (the constructor call of
>> > HTable is hanging)
>> >
>> > [error] (run-main-0)
>> > org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>> > find region for truck_events,,99999999999999 after 14 tries.
>> > org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
>> > find region for truck_events,,99999999999999 after 14 tries.
>> >         at
>> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
>> >         at
>> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
>> >         at
>> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
>> >         at
>> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
>> >         at
>> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
>> >         at
>> org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
>> >         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
>> >         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
>> >         at HbaseConnector$.main(HbaseConnector.scala:18)
>> >         at HbaseConnector.main(HbaseConnector.scala)
>> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >         at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> >         at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> >         at java.lang.reflect.Method.invoke(Method.java:606)
>> > [trace] Stack trace suppressed: run last compile:run for the full output.
>> > 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
>> > to interruption
>> > java.lang.InterruptedException
>> >         at
>> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
>> >         at
>> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
>> >         at
>> java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
>> >         at
>> org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
>> > 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
>> > java.lang.RuntimeException: Nonzero exit code: 1
>> >         at scala.sys.package$.error(package.scala:27)
>> > [trace] Stack trace suppressed: run last compile:run for the full output.
>> > [error] (compile:run) Nonzero exit code: 1
>> > [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
>> >
>> >
>> > In the RegionServer log, I've seen this:
>> >
>> > 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
>> > ipc.RpcServer: RpcServer.listener,port=60020: connection from
>> > 10.97.68.159:41772; # active connections: 1
>> > 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
>> > ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>> > 10.97.68.159:41772 because read count=-1. Number of active
>> > connections: 1
>> > 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
>> > Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>> > accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
>> > cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
>> > evictedPerRun=0.0
>> > 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
>> > ipc.RpcServer: RpcServer.listener,port=60020: connection from
>> > 10.97.68.159:42728; # active connections: 1
>> > 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
>> > ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
>> > 10.97.68.159:42728 because read count=-1. Number of active
>> > connections: 1
>> > 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
>> > Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
>> > accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
>> > cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
>> > evictedPerRun=0.0
>> >
>> > So it connects and disconnects with read count -1 .
>> >
>> > Can anybody help me finding the root cause of this issue ? I've tried
>> > to restart Hbase and so on but with no effect. Hive is also working
>> > fine, just not my coding :(
>> >
>> > Thanks a lot,
>> > Marco
>>
>>
>>
>> --
>> Viele Grüße,
>> Marco
>>



-- 
Viele Grüße,
Marco

Re: Cannot connect to Hbase via Java API

Posted by Ted Yu <yu...@gmail.com>.
bq. conf.clear()

Why is the above needed ?
Try removing it.

Cheers

On Tue, Dec 16, 2014 at 7:57 AM, Marco <ma...@gmail.com> wrote:
>
> no effect :(
>
> 2014-12-16 15:19 GMT+01:00 Marco <ma...@gmail.com>:
> > Hi,
> >
> > Hbase is installed correctly and working (hbase shell works fine).
> >
> > But I'm not able to use the Java API to connect to an existing Hbase
> Table:
> >
> > <<<
> > val conf = HBaseConfiguration.create()
> >
> > conf.clear()
> >
> > conf.set("hbase.zookeeper.quorum", "ip:2181");
> > conf.set("hbase.zookeeper.property.clientPort", "2181");
> > conf.set("hbase.zookeeper.dns.nameserver", "ip");
> > conf.set("hbase.regionserver.port","60020");
> > conf.set("hbase.master", "ip:60000");
> >
> > val hTable = new HTable(conf, "truck_events")
> >
> >>>>
> >
> > Actually the coding is Scala but I think it is understandable, what I
> > am trying to achieve. I've tried also to use hbase-site.xml instead of
> > manually configuring it -  but the result is the same.
> >
> > As response I got
> > 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
> > connection, connectString=ip:2181 sessionTimeout=30000
> > watcher=hconnection
> > 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
> > to server ip:2181. Will not attempt to authenticate using SASL
> > (unknown error)
> > 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
> > established to ip:2181, initiating session
> > 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
> > complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
> > timeout = 30000
> >
> > and then finally after a couple of minutes: (the constructor call of
> > HTable is hanging)
> >
> > [error] (run-main-0)
> > org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> > find region for truck_events,,99999999999999 after 14 tries.
> > org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> > find region for truck_events,,99999999999999 after 14 tries.
> >         at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
> >         at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
> >         at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
> >         at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
> >         at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
> >         at
> org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
> >         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
> >         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
> >         at HbaseConnector$.main(HbaseConnector.scala:18)
> >         at HbaseConnector.main(HbaseConnector.scala)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >         at java.lang.reflect.Method.invoke(Method.java:606)
> > [trace] Stack trace suppressed: run last compile:run for the full output.
> > 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
> > to interruption
> > java.lang.InterruptedException
> >         at
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
> >         at
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
> >         at
> java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
> >         at
> org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
> > 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
> > java.lang.RuntimeException: Nonzero exit code: 1
> >         at scala.sys.package$.error(package.scala:27)
> > [trace] Stack trace suppressed: run last compile:run for the full output.
> > [error] (compile:run) Nonzero exit code: 1
> > [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
> >
> >
> > In the RegionServer log, I've seen this:
> >
> > 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
> > ipc.RpcServer: RpcServer.listener,port=60020: connection from
> > 10.97.68.159:41772; # active connections: 1
> > 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
> > ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> > 10.97.68.159:41772 because read count=-1. Number of active
> > connections: 1
> > 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
> > Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> > accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
> > cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
> > evictedPerRun=0.0
> > 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
> > ipc.RpcServer: RpcServer.listener,port=60020: connection from
> > 10.97.68.159:42728; # active connections: 1
> > 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
> > ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> > 10.97.68.159:42728 because read count=-1. Number of active
> > connections: 1
> > 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
> > Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> > accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
> > cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
> > evictedPerRun=0.0
> >
> > So it connects and disconnects with read count -1 .
> >
> > Can anybody help me finding the root cause of this issue ? I've tried
> > to restart Hbase and so on but with no effect. Hive is also working
> > fine, just not my coding :(
> >
> > Thanks a lot,
> > Marco
>
>
>
> --
> Viele Grüße,
> Marco
>

Re: Cannot connect to Hbase via Java API

Posted by Marco <ma...@gmail.com>.
no effect :(

2014-12-16 15:19 GMT+01:00 Marco <ma...@gmail.com>:
> Hi,
>
> Hbase is installed correctly and working (hbase shell works fine).
>
> But I'm not able to use the Java API to connect to an existing Hbase Table:
>
> <<<
> val conf = HBaseConfiguration.create()
>
> conf.clear()
>
> conf.set("hbase.zookeeper.quorum", "ip:2181");
> conf.set("hbase.zookeeper.property.clientPort", "2181");
> conf.set("hbase.zookeeper.dns.nameserver", "ip");
> conf.set("hbase.regionserver.port","60020");
> conf.set("hbase.master", "ip:60000");
>
> val hTable = new HTable(conf, "truck_events")
>
>>>>
>
> Actually the coding is Scala but I think it is understandable, what I
> am trying to achieve. I've tried also to use hbase-site.xml instead of
> manually configuring it -  but the result is the same.
>
> As response I got
> 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
> connection, connectString=ip:2181 sessionTimeout=30000
> watcher=hconnection
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
> to server ip:2181. Will not attempt to authenticate using SASL
> (unknown error)
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
> established to ip:2181, initiating session
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
> complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
> timeout = 30000
>
> and then finally after a couple of minutes: (the constructor call of
> HTable is hanging)
>
> [error] (run-main-0)
> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> find region for truck_events,,99999999999999 after 14 tries.
> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> find region for truck_events,,99999999999999 after 14 tries.
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
>         at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
>         at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
>         at HbaseConnector$.main(HbaseConnector.scala:18)
>         at HbaseConnector.main(HbaseConnector.scala)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
> [trace] Stack trace suppressed: run last compile:run for the full output.
> 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
> to interruption
> java.lang.InterruptedException
>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
>         at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
>         at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
>         at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
> 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
> java.lang.RuntimeException: Nonzero exit code: 1
>         at scala.sys.package$.error(package.scala:27)
> [trace] Stack trace suppressed: run last compile:run for the full output.
> [error] (compile:run) Nonzero exit code: 1
> [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
>
>
> In the RegionServer log, I've seen this:
>
> 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: connection from
> 10.97.68.159:41772; # active connections: 1
> 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> 10.97.68.159:41772 because read count=-1. Number of active
> connections: 1
> 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
> cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
> evictedPerRun=0.0
> 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: connection from
> 10.97.68.159:42728; # active connections: 1
> 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> 10.97.68.159:42728 because read count=-1. Number of active
> connections: 1
> 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
> cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
> evictedPerRun=0.0
>
> So it connects and disconnects with read count -1 .
>
> Can anybody help me finding the root cause of this issue ? I've tried
> to restart Hbase and so on but with no effect. Hive is also working
> fine, just not my coding :(
>
> Thanks a lot,
> Marco



-- 
Viele Grüße,
Marco

Re: Cannot connect to Hbase via Java API

Posted by Ted Yu <yu...@gmail.com>.
bq. conf.set("hbase.zookeeper.quorum", "ip:2181");

Have you tried omitting port in the above config ?

On Tue, Dec 16, 2014 at 6:19 AM, Marco <ma...@gmail.com> wrote:
>
> Hi,
>
> Hbase is installed correctly and working (hbase shell works fine).
>
> But I'm not able to use the Java API to connect to an existing Hbase Table:
>
> <<<
> val conf = HBaseConfiguration.create()
>
> conf.clear()
>
> conf.set("hbase.zookeeper.quorum", "ip:2181");
> conf.set("hbase.zookeeper.property.clientPort", "2181");
> conf.set("hbase.zookeeper.dns.nameserver", "ip");
> conf.set("hbase.regionserver.port","60020");
> conf.set("hbase.master", "ip:60000");
>
> val hTable = new HTable(conf, "truck_events")
>
> >>>
>
> Actually the coding is Scala but I think it is understandable, what I
> am trying to achieve. I've tried also to use hbase-site.xml instead of
> manually configuring it -  but the result is the same.
>
> As response I got
> 14/12/16 15:10:05 INFO zookeeper.ZooKeeper: Initiating client
> connection, connectString=ip:2181 sessionTimeout=30000
> watcher=hconnection
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Opening socket connection
> to server ip:2181. Will not attempt to authenticate using SASL
> (unknown error)
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Socket connection
> established to ip:2181, initiating session
> 14/12/16 15:10:10 INFO zookeeper.ClientCnxn: Session establishment
> complete on server ip:2181, sessionid = 0x14a53583e080010, negotiated
> timeout = 30000
>
> and then finally after a couple of minutes: (the constructor call of
> HTable is hanging)
>
> [error] (run-main-0)
> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> find region for truck_events,,99999999999999 after 14 tries.
> org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to
> find region for truck_events,,99999999999999 after 14 tries.
>         at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1092)
>         at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:997)
>         at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1099)
>         at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:1001)
>         at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:958)
>         at
> org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251)
>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155)
>         at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129)
>         at HbaseConnector$.main(HbaseConnector.scala:18)
>         at HbaseConnector.main(HbaseConnector.scala)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
> [trace] Stack trace suppressed: run last compile:run for the full output.
> 14/12/16 13:22:15 ERROR zookeeper.ClientCnxn: Event thread exiting due
> to interruption
> java.lang.InterruptedException
>         at
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
>         at
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
>         at
> java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
>         at
> org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:491)
> 14/12/16 13:22:15 INFO zookeeper.ClientCnxn: EventThread shut down
> java.lang.RuntimeException: Nonzero exit code: 1
>         at scala.sys.package$.error(package.scala:27)
> [trace] Stack trace suppressed: run last compile:run for the full output.
> [error] (compile:run) Nonzero exit code: 1
> [error] Total time: 1106 s, completed Dec 16, 2014 1:22:15 PM
>
>
> In the RegionServer log, I've seen this:
>
> 2014-12-16 13:31:34,087 DEBUG [RpcServer.listener,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: connection from
> 10.97.68.159:41772; # active connections: 1
> 2014-12-16 13:33:34,220 DEBUG [RpcServer.reader=1,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> 10.97.68.159:41772 because read count=-1. Number of active
> connections: 1
> 2014-12-16 13:36:26,988 DEBUG [LruStats #0] hfile.LruBlockCache:
> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> accesses=28, hits=24, hitRatio=85.71%, , cachingAccesses=28,
> cachingHits=24, cachingHitsRatio=85.71%, evictions=269, evicted=0,
> evictedPerRun=0.0
> 2014-12-16 13:36:34,017 DEBUG [RpcServer.listener,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: connection from
> 10.97.68.159:42728; # active connections: 1
> 2014-12-16 13:38:34,112 DEBUG [RpcServer.reader=2,port=60020]
> ipc.RpcServer: RpcServer.listener,port=60020: DISCONNECTING client
> 10.97.68.159:42728 because read count=-1. Number of active
> connections: 1
> 2014-12-16 13:41:26,989 DEBUG [LruStats #0] hfile.LruBlockCache:
> Total=430.02 KB, free=401.18 MB, max=401.60 MB, blockCount=4,
> accesses=30, hits=26, hitRatio=86.67%, , cachingAccesses=30,
> cachingHits=26, cachingHitsRatio=86.67%, evictions=299, evicted=0,
> evictedPerRun=0.0
>
> So it connects and disconnects with read count -1 .
>
> Can anybody help me finding the root cause of this issue ? I've tried
> to restart Hbase and so on but with no effect. Hive is also working
> fine, just not my coding :(
>
> Thanks a lot,
> Marco
>