You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Keith Thomas <ke...@gmail.com> on 2009/10/05 17:00:32 UTC

HBase client query

Hi, 

I am trying to move my HBase client application from,

- a Ubuntu Virtual Machine running HBase in pseudo distributed mode with
default configuration settings, to,
- the OS X machine hosting the Ubuntu Virtual Machine running HBase

Based upon other Nabble threads I have inserted a set() line into my code,

		        this.hbConfig = new HBaseConfiguration();
		        this.hbConfig.set("hbase.master", "192.168.1.19:60000"); // New
code added
		        this.hbAdmin = new HBaseAdmin(this.hbConfig);

but I see the following exception thrown when executing the 'new
HBaseAdmin(...)' statement,

org.apache.hadoop.hbase.MasterNotRunningException
	at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.getMaster(HConnectionManager.java:347)

I am suspicious I have not configured my client correctly as I cannot find
an "hbase.master" property in my HBase XML config files. Apologies if there
are some docs I should have read, if this is the case please just point me
at the appropriate docs.





-- 
View this message in context: http://www.nabble.com/HBase-client-query-tp25752430p25752430.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: HBase client query / required configs for a hbase client

Posted by Bob Schulze <b....@ecircle.com>.
Ok, to answer myself: to write a standalone hbase client, it seems to be
enough to

* set up the zookeeper server(s) to  ask around:
  HConstants.ZOOKEEPER_QUORUM ("hbase.zookeeper.quorum")
* if different from std, set the zk port
   "hbase.zookeeper.property.clientPort"
* if different from std, , set the port to the region and master servers
* add hadoop, hbase and zookeeper jars to your project.
* open the ports to the hbase servers and to zk

In my case, the zookeeper port was not open in the firewalls...

Bob

...

Re: HBase client query / required configs for a hbase client

Posted by Bob Schulze <b....@ecircle.com>.
Hi,

	thx for the answers in this thread, but is there anywhere a description
on how to connect from a client? I mean, before (0.20) it was enough to
instantiate HTable/HBaseAdmin by just setting the master address in the
configuration (as in Keith' example). Now it seems to expect a lot more
(like stuff from zoo.cfg)...but what exactly is needed?

I certainly dont want to have _all_ configs from the server instance
around....

Thx again for any pointers,

	Bob

Keith Thomas schrieb:
> Hi, 
> 
> I am trying to move my HBase client application from,
> 
> - a Ubuntu Virtual Machine running HBase in pseudo distributed mode with
> default configuration settings, to,
> - the OS X machine hosting the Ubuntu Virtual Machine running HBase
> 
> Based upon other Nabble threads I have inserted a set() line into my code,
> 
> 		        this.hbConfig = new HBaseConfiguration();
> 		        this.hbConfig.set("hbase.master", "192.168.1.19:60000"); // New
> code added
> 		        this.hbAdmin = new HBaseAdmin(this.hbConfig);
> 
> but I see the following exception thrown when executing the 'new
> HBaseAdmin(...)' statement,
> 
> org.apache.hadoop.hbase.MasterNotRunningException
> 	at
> org.apache.hadoop.hbase.client.HConnectionManager$TableServers.getMaster(HConnectionManager.java:347)
> 
> I am suspicious I have not configured my client correctly as I cannot find
> an "hbase.master" property in my HBase XML config files. Apologies if there
> are some docs I should have read, if this is the case please just point me
> at the appropriate docs.
> 
> 
> 
> 
> 


-- 

	Bob Schulze
	Head Software Development
	eCircle AG, Munich, Germany
	+49-89-12009-703

Re: HBase client query

Posted by Keith Thomas <ke...@gmail.com>.
Tatsuya,

This worked perfectly many thanks.

-Keith


Tatsuya Kawano wrote:
> 
> Keith,
> 
> This virtual Ubuntu server is for development, not for production, right?
> 
> If so, try editing "/etc/hosts" of the Ubuntu server, so that it can
> resolve the correct IP (192.168.1.19) from its hostname.
> 
> First two entries of /etc/hosts should like this:
> 
>   127.0.0.1   localhost
>   127.0.1.1   your-host-name
>    ...
> 
> So replace 127.0.1.1 on the second line with 192.168.1.19. You
> shouldn't have to restart your server, but HBase.
> 
> Please note that when you deploy production servers, you'll definitely
> need DNS entries for them.
> 
> Thanks,
> 
> -- 
> Tatsuya Kawano (Mr.)
> Tokyo, Japan
> 
> 
> On Fri, Oct 9, 2009 at 8:46 AM, Keith Thomas <ke...@gmail.com>
> wrote:
>>
>> Thank you Barney Frank, your detailed notes were very helpful in
>> confirming I
>> was doing things correctly already on the client. I did a lot of tracing
>> through the HBase code and concluded that the  problem lay with my
>> server.
>>
>> It looks like 0.20.0 has all sorts of DNS config entries and by default
>> in
>> my setup, the address of my one server - running peudo distributed hbase
>> and
>> hadoop for development purposes - resolves to 127.0.1.1 all the time. My
>> client gets back all sorts of addressing details from the server (from
>> zookeeper presumably) telling my client things are running on 127.0.1.1,
>> which of course they are not.
>>
>> I think my question now boils down to how can I configure Zookeeper so it
>> will return the address of the virtual machine it is running on
>> automatically, regardless of whether my laptop is connected to a network
>> or
>> running disconnected on on a plane.
>>
>> To a newbie like myself he pre-0.20.0 type functionality (e..g.
>> 'hbase.master') seems to be more likely to meet my needs than a DNS based
>> solution, but what do I know :-)
> 
> 

-- 
View this message in context: http://www.nabble.com/HBase-client-query-tp25752430p25814722.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: HBase client query

Posted by Tatsuya Kawano <ta...@snowcocoa.info>.
Keith,

This virtual Ubuntu server is for development, not for production, right?

If so, try editing "/etc/hosts" of the Ubuntu server, so that it can
resolve the correct IP (192.168.1.19) from its hostname.

First two entries of /etc/hosts should like this:

  127.0.0.1   localhost
  127.0.1.1   your-host-name
   ...

So replace 127.0.1.1 on the second line with 192.168.1.19. You
shouldn't have to restart your server, but HBase.

Please note that when you deploy production servers, you'll definitely
need DNS entries for them.

Thanks,

-- 
Tatsuya Kawano (Mr.)
Tokyo, Japan


On Fri, Oct 9, 2009 at 8:46 AM, Keith Thomas <ke...@gmail.com> wrote:
>
> Thank you Barney Frank, your detailed notes were very helpful in confirming I
> was doing things correctly already on the client. I did a lot of tracing
> through the HBase code and concluded that the  problem lay with my server.
>
> It looks like 0.20.0 has all sorts of DNS config entries and by default in
> my setup, the address of my one server - running peudo distributed hbase and
> hadoop for development purposes - resolves to 127.0.1.1 all the time. My
> client gets back all sorts of addressing details from the server (from
> zookeeper presumably) telling my client things are running on 127.0.1.1,
> which of course they are not.
>
> I think my question now boils down to how can I configure Zookeeper so it
> will return the address of the virtual machine it is running on
> automatically, regardless of whether my laptop is connected to a network or
> running disconnected on on a plane.
>
> To a newbie like myself he pre-0.20.0 type functionality (e..g.
> 'hbase.master') seems to be more likely to meet my needs than a DNS based
> solution, but what do I know :-)

Re: HBase client query

Posted by Keith Thomas <ke...@gmail.com>.
Thanks J-D, sorry I was slow on the uptake, now I understand exactly what you
mean. 

Fyi I want two different machines running on my one laptop because I am
writing a framework plug-in not an app and as part of the docs I am writing
I have to describe how to configure my plug-in to work in an instance of an
app working on a different machine to HBase.

I am now working.

-Keith


Jean-Daniel Cryans-2 wrote:
> 
> Keith,
> 
> This is exactly what I said in my first email, by default the value is
> localhost and the IP it points to depends on your OS config which in
> your case is 127.0.1.1
> 
> The thing with hbase.master is that since HBase is now capable of
> handling master failover, this value would only make sense if the
> master never dies or if the new master has the same address. Also,
> pseudo-distributed is more meant for local operation so instead of
> running it inside a VM you should run it directly in OSX... unless
> there's a particular reason why you want to maintain a VM.
> 
> J-D
> 
> On Thu, Oct 8, 2009 at 7:46 PM, Keith Thomas <ke...@gmail.com>
> wrote:
>>
>> Thank you Barney Frank, your detailed notes were very helpful in
>> confirming I
>> was doing things correctly already on the client. I did a lot of tracing
>> through the HBase code and concluded that the  problem lay with my
>> server.
>>
>> It looks like 0.20.0 has all sorts of DNS config entries and by default
>> in
>> my setup, the address of my one server - running peudo distributed hbase
>> and
>> hadoop for development purposes - resolves to 127.0.1.1 all the time. My
>> client gets back all sorts of addressing details from the server (from
>> zookeeper presumably) telling my client things are running on 127.0.1.1,
>> which of course they are not.
>>
>> I think my question now boils down to how can I configure Zookeeper so it
>> will return the address of the virtual machine it is running on
>> automatically, regardless of whether my laptop is connected to a network
>> or
>> running disconnected on on a plane.
>>
>> To a newbie like myself he pre-0.20.0 type functionality (e..g.
>> 'hbase.master') seems to be more likely to meet my needs than a DNS based
>> solution, but what do I know :-)
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/HBase-client-query-tp25752430p25813504.html
>> Sent from the HBase User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/HBase-client-query-tp25752430p25814717.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: HBase client query

Posted by Jean-Daniel Cryans <jd...@apache.org>.
Keith,

This is exactly what I said in my first email, by default the value is
localhost and the IP it points to depends on your OS config which in
your case is 127.0.1.1

The thing with hbase.master is that since HBase is now capable of
handling master failover, this value would only make sense if the
master never dies or if the new master has the same address. Also,
pseudo-distributed is more meant for local operation so instead of
running it inside a VM you should run it directly in OSX... unless
there's a particular reason why you want to maintain a VM.

J-D

On Thu, Oct 8, 2009 at 7:46 PM, Keith Thomas <ke...@gmail.com> wrote:
>
> Thank you Barney Frank, your detailed notes were very helpful in confirming I
> was doing things correctly already on the client. I did a lot of tracing
> through the HBase code and concluded that the  problem lay with my server.
>
> It looks like 0.20.0 has all sorts of DNS config entries and by default in
> my setup, the address of my one server - running peudo distributed hbase and
> hadoop for development purposes - resolves to 127.0.1.1 all the time. My
> client gets back all sorts of addressing details from the server (from
> zookeeper presumably) telling my client things are running on 127.0.1.1,
> which of course they are not.
>
> I think my question now boils down to how can I configure Zookeeper so it
> will return the address of the virtual machine it is running on
> automatically, regardless of whether my laptop is connected to a network or
> running disconnected on on a plane.
>
> To a newbie like myself he pre-0.20.0 type functionality (e..g.
> 'hbase.master') seems to be more likely to meet my needs than a DNS based
> solution, but what do I know :-)
>
>
> --
> View this message in context: http://www.nabble.com/HBase-client-query-tp25752430p25813504.html
> Sent from the HBase User mailing list archive at Nabble.com.
>
>

Re: HBase client query

Posted by Keith Thomas <ke...@gmail.com>.
Thank you Barney Frank, your detailed notes were very helpful in confirming I
was doing things correctly already on the client. I did a lot of tracing
through the HBase code and concluded that the  problem lay with my server. 

It looks like 0.20.0 has all sorts of DNS config entries and by default in
my setup, the address of my one server - running peudo distributed hbase and
hadoop for development purposes - resolves to 127.0.1.1 all the time. My
client gets back all sorts of addressing details from the server (from
zookeeper presumably) telling my client things are running on 127.0.1.1,
which of course they are not. 

I think my question now boils down to how can I configure Zookeeper so it
will return the address of the virtual machine it is running on
automatically, regardless of whether my laptop is connected to a network or
running disconnected on on a plane. 

To a newbie like myself he pre-0.20.0 type functionality (e..g.
'hbase.master') seems to be more likely to meet my needs than a DNS based
solution, but what do I know :-)


-- 
View this message in context: http://www.nabble.com/HBase-client-query-tp25752430p25813504.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: HBase client query

Posted by Barney Frank <ba...@gmail.com>.
 You owe me big time, Keith.

2 snippets:
*

static* *private* HTablePool *hbase* = *getTablePool*();

HBaseConfiguration config = *new* HBaseConfiguration();

config.addResource(*new* Path("/home/user/configdata/system/hbase-site.xml"
));
Later i use the config:

HTable table=*null*;

Result r=*null*;

*try* {

table = *hbase*.getTable("contact");

Get g = *new* Get(Bytes.*toBytes*(someid)).setMaxVersions();

r = table.get(g);

table.close();

}

Then I use the result to retrieve data.


My site file:

<configuration>

<property>

<name>hbase.zookeeper.quorum</name>

<value>some-server</value>

</property>


On Wed, Oct 7, 2009 at 9:31 PM, Keith Thomas <ke...@gmail.com> wrote:

>
> All, sorry to bring this post back to life but I am still stuck :(
>
> If anyone has some example 0.20.0 configurations and code they could share
> with me regards to running a Java client on a different machine to HBase
> and
> Hadoop that would be brilliant :)
>
> Many thanks.
> --
> View this message in context:
> http://www.nabble.com/HBase-client-query-tp25752430p25797489.html
>  Sent from the HBase User mailing list archive at Nabble.com.
>
>

Re: HBase client query

Posted by Keith Thomas <ke...@gmail.com>.
All, sorry to bring this post back to life but I am still stuck :( 

If anyone has some example 0.20.0 configurations and code they could share
with me regards to running a Java client on a different machine to HBase and
Hadoop that would be brilliant :) 

Many thanks.
-- 
View this message in context: http://www.nabble.com/HBase-client-query-tp25752430p25797489.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: HBase client query

Posted by Keith Thomas <ke...@gmail.com>.
Thanks J-D,

Apologies for not including the HBase version details, you are correct I am
using 0.20.0. I made the recommended change so that my code now looks like
this,

		        this.hbConfig = new HBaseConfiguration();
		        this.hbConfig.set("hbase.zookeeper.quorum", "192.168.1.19");
		        this.hbAdmin = new HBaseAdmin(this.hbConfig);

This has now moved the problem, the client now hangs on the 'new
HBaseAdmin()' statement.  The zookeeper is recording the following messages
as my app starts up and tries to connect to HBase (192.168.1.3 is the
address of my client machine),

2009-10-05 10:08:58,583 INFO org.apache.zookeeper.server.NIOServerCnxn:
Connected to /192.168.1.3:65487 lastZxid 0
2009-10-05 10:08:58,583 INFO org.apache.zookeeper.server.NIOServerCnxn:
Creating new session 0x1242525d0980006
2009-10-05 10:08:58,585 INFO org.apache.zookeeper.server.NIOServerCnxn:
Finished init of 0x1242525d0980006 valid:true

This appears to be the only log file that is updated. When I cancel my hung
client the following messages then appear in the zookeeper log file,

2009-10-05 10:33:17,834 WARN org.apache.zookeeper.server.NIOServerCnxn:
Exception causing close of session 0x1242525d0980006 due to
java.io.IOException: Read error
2009-10-05 10:33:17,836 INFO org.apache.zookeeper.server.NIOServerCnxn:
closing session:0x1242525d0980006 NIOServerCnxn:
java.nio.channels.SocketChannel[connected local=/192.168.1.19:2181
remote=/192.168.1.3:65487]
2009-10-05 10:33:46,000 INFO org.apache.zookeeper.server.SessionTrackerImpl:
Expiring session 0x1242525d0980006
2009-10-05 10:33:46,000 INFO org.apache.zookeeper.server.ZooKeeperServer:
Expiring session 0x1242525d0980006
2009-10-05 10:33:46,000 INFO
org.apache.zookeeper.server.PrepRequestProcessor: Processed session
termination request for id: 0x1242525d0980006

Both systems (client and server) have their firewalls off (I think). Again
any suggestions as to what I am doing wrong or where I should go for related
docs would be great.

-Keith
-- 
View this message in context: http://www.nabble.com/HBase-client-query-tp25752430p25754228.html
Sent from the HBase User mailing list archive at Nabble.com.


Re: HBase client query

Posted by Jean-Daniel Cryans <jd...@apache.org>.
Keith,

If you are using HBase 0.20 (you didn't tell) then hbase.master is
deprecated. The new setting in 0.20 to set inside clients is
hbase.zookeeper.quorum which by default is localhost. See what
"localhost" resolves to inside your VM and if it's not 127.0.0.1 (or
some equivalent) then try setting  hbase.zookeeper.quorum to that
value in your client.

J-D

On Mon, Oct 5, 2009 at 11:00 AM, Keith Thomas <ke...@gmail.com> wrote:
>
> Hi,
>
> I am trying to move my HBase client application from,
>
> - a Ubuntu Virtual Machine running HBase in pseudo distributed mode with
> default configuration settings, to,
> - the OS X machine hosting the Ubuntu Virtual Machine running HBase
>
> Based upon other Nabble threads I have inserted a set() line into my code,
>
>                        this.hbConfig = new HBaseConfiguration();
>                        this.hbConfig.set("hbase.master", "192.168.1.19:60000"); // New
> code added
>                        this.hbAdmin = new HBaseAdmin(this.hbConfig);
>
> but I see the following exception thrown when executing the 'new
> HBaseAdmin(...)' statement,
>
> org.apache.hadoop.hbase.MasterNotRunningException
>        at
> org.apache.hadoop.hbase.client.HConnectionManager$TableServers.getMaster(HConnectionManager.java:347)
>
> I am suspicious I have not configured my client correctly as I cannot find
> an "hbase.master" property in my HBase XML config files. Apologies if there
> are some docs I should have read, if this is the case please just point me
> at the appropriate docs.
>
>
>
>
>
> --
> View this message in context: http://www.nabble.com/HBase-client-query-tp25752430p25752430.html
> Sent from the HBase User mailing list archive at Nabble.com.
>
>