You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by SACHINGUPTA <sa...@datametica.com> on 2014/09/29 14:43:38 UTC

Access hbase remotely from java client

Hello guys

I am using the hbase java api to connect to hbase remotely, but when I 
executed the java code, got |MasterNotRunningException|. When I debugged 
the code, I came to know that zookeeper was returning the address of 
hmaster as localhost.localdomain, so the client was trying to search for 
the hmaster locally. When I changed the |/etc/hosts| file of my local 
machine from where i am running the java client as:

|<ip of the master>  localhost.localdomain|

then it worked fine.

However, I think that this is not the right way. I think I have to 
change the addresses somewhere in the configuration of zookeeper, but I 
did not get it.

please help
thanks


-- 
Thanks
Sachin Gupta


Re: Access hbase remotely from java client

Posted by Sean Busbey <bu...@cloudera.com>.
It sounds like your VM host is not properly configured for remote access;
the canonical hostname should not be any of the localhost derivatives if
you are going to try to use the machine remotely.

If necessary, there are configuration settings you can use to change what
interface HBase looks at to determine what host name to advertise in
ZooKeeper. However, in this case you will avoid more problems in the future
by correcting the canonical hostname.

AFAIK, the Cloudera Quickstart VM is not meant to be used by remote
clients. Since this is a vendor specific problem rather than a problem with
HBase, I'd suggest you check for hep at the vendor's community forum:

http://community.cloudera.com/

One thing to check is that you are using the latest Quickstart VM, if I
recall correctly work was done on the update to C5 to make sure the
canonical hostname wasn't localhost.localdomain.


-Sean

On Mon, Sep 29, 2014 at 10:21 AM, SACHINGUPTA <sa...@datametica.com> wrote:

> 'hostname' command returns localhost.localdomain
> I am having a cloudera quick start vm so i am using that as my cluster so
> whatever cloudera provides i have it.
>
> And i am trying to access the hbase of cloudera vm remotely
>
> On Monday 29 September 2014 08:38 PM, Sean Busbey wrote:
>
>> What does the "hostname" command return on the master?
>>
>> Do you have any backup-masters configured?
>>
>> What is the contents of your regionservers file?
>>
>> On Mon, Sep 29, 2014 at 9:55 AM, SACHINGUPTA <sa...@datametica.com>
>> wrote:
>>
>>  yes
>>>
>>> On Monday 29 September 2014 08:18 PM, Sean Busbey wrote:
>>>
>>>  Does the IP you listed properly handle DNS resolution? You should make
>>>> sure
>>>> forward and reverse look up work properly for hosts used.
>>>>
>>>> Generally you should also configure things via host name and not IP
>>>> address.
>>>>
>>>> On Mon, Sep 29, 2014 at 8:17 AM, SACHINGUPTA <sa...@datametica.com>
>>>> wrote:
>>>>
>>>>   java client
>>>>
>>>>> package com.example.hbaseconnect.HBaseConnect;
>>>>>
>>>>> import java.io.IOException;
>>>>>
>>>>> import org.apache.hadoop.conf.Configuration;
>>>>> import org.apache.hadoop.hbase.HBaseConfiguration;
>>>>> import org.apache.hadoop.hbase.client.HBaseAdmin;
>>>>> import org.apache.hadoop.hbase.client.HTable;
>>>>> import org.apache.hadoop.hbase.client.Scan;
>>>>>
>>>>> public class HBaseConnect {
>>>>>       public static void main(String[] args) throws IOException {
>>>>>           Configuration conf = HBaseConfiguration.create();
>>>>>           conf.clear();
>>>>>           conf.addResource("hbase-site.xml");
>>>>>           conf.set("hbase.zookeeper.quorum","10.255.1.61");
>>>>>           conf.set("hbase.zookeeper.property.clientPort","2181");
>>>>>           conf.set("hbase.master", "10.255.1.61:60010");
>>>>>
>>>>>           HBaseAdmin.checkHBaseAvailable(conf);
>>>>>           System.out.println("connected to hbase");
>>>>>           HTable table = new HTable(conf, "bunty");
>>>>>           Scan scan = new Scan();
>>>>>       }
>>>>> }
>>>>>
>>>>>
>>>>> client side hbase-site.xml
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>
>>>>> <!--Autogenerated by Cloudera CM on 2014-08-28T02:35:59.408Z-->
>>>>> <configuration>
>>>>>     <property>
>>>>>       <name>hbase.rootdir</name>
>>>>>       <value>hdfs://10.255.1.61:8020/hbase</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>hbase.client.write.buffer</name>
>>>>>       <value>2097152</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>hbase.client.pause</name>
>>>>>       <value>1000</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>hbase.client.retries.number</name>
>>>>>       <value>10</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>hbase.client.scanner.caching</name>
>>>>>       <value>1</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>hbase.client.keyvalue.maxsize</name>
>>>>>       <value>10485760</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>hbase.rpc.timeout</name>
>>>>>       <value>60000</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>hbase.security.authentication</name>
>>>>>       <value>simple</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>zookeeper.session.timeout</name>
>>>>>       <value>60000</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>zookeeper.znode.parent</name>
>>>>>       <value>/hbase</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>zookeeper.znode.rootserver</name>
>>>>>       <value>root-region-server</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>hbase.zookeeper.quorum</name>
>>>>>       <value>10.255.1.61</value>
>>>>>     </property>
>>>>>     <property>
>>>>>       <name>hbase.zookeeper.property.clientPort</name>
>>>>>       <value>2181</value>
>>>>>     </property>
>>>>> </configuration>
>>>>>
>>>>>
>>>>> On Monday 29 September 2014 06:35 PM, Wellington Chevreuil wrote:
>>>>>
>>>>>   Hi,
>>>>>
>>>>>> You should not do this, as localhost should resolve to the own host.
>>>>>> This
>>>>>> is probably some missing property on the clients hbase configuration
>>>>>> (make
>>>>>> sure you have a proper hbase-site.xml on client's classpath or set
>>>>>> configuration programatically). As a start, check if you had set the
>>>>>> properties below on your client's hbase config.
>>>>>>
>>>>>>     <property>
>>>>>>        <name>hbase.zookeeper.quorum</name>
>>>>>>        <value>ZK_HOSTS</value>
>>>>>>      </property>
>>>>>>      <property>
>>>>>>        <name>hbase.zookeeper.property.clientPort</name>
>>>>>>        <value>2181</value>
>>>>>>      </property>
>>>>>>
>>>>>>
>>>>>> On 29 Sep 2014, at 13:43, SACHINGUPTA <sa...@datametica.com> wrote:
>>>>>>
>>>>>>    Hello guys
>>>>>>
>>>>>>  I am using the hbase java api to connect to hbase remotely, but when
>>>>>>> I
>>>>>>> executed the java code, got |MasterNotRunningException|. When I
>>>>>>> debugged
>>>>>>> the code, I came to know that zookeeper was returning the address of
>>>>>>> hmaster as localhost.localdomain, so the client was trying to search
>>>>>>> for
>>>>>>> the hmaster locally. When I changed the |/etc/hosts| file of my local
>>>>>>> machine from where i am running the java client as:
>>>>>>>
>>>>>>> |<ip of the master>  localhost.localdomain|
>>>>>>>
>>>>>>> then it worked fine.
>>>>>>>
>>>>>>> However, I think that this is not the right way. I think I have to
>>>>>>> change the addresses somewhere in the configuration of zookeeper, but
>>>>>>> I did
>>>>>>> not get it.
>>>>>>>
>>>>>>> please help
>>>>>>> thanks
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Thanks
>>>>>>> Sachin Gupta
>>>>>>>
>>>>>>>
>>>>>>>   --
>>>>>>>
>>>>>> Thanks
>>>>> Sachin Gupta
>>>>>
>>>>>
>>>>>
>>>>>  --
>>> Thanks
>>> Sachin Gupta
>>>
>>>
>>>
>>
> --
> Thanks
> Sachin Gupta
>
>


-- 
Sean

Re: Access hbase remotely from java client

Posted by SACHINGUPTA <sa...@datametica.com>.
'hostname' command returns localhost.localdomain
I am having a cloudera quick start vm so i am using that as my cluster 
so whatever cloudera provides i have it.

And i am trying to access the hbase of cloudera vm remotely
On Monday 29 September 2014 08:38 PM, Sean Busbey wrote:
> What does the "hostname" command return on the master?
>
> Do you have any backup-masters configured?
>
> What is the contents of your regionservers file?
>
> On Mon, Sep 29, 2014 at 9:55 AM, SACHINGUPTA <sa...@datametica.com> wrote:
>
>> yes
>>
>> On Monday 29 September 2014 08:18 PM, Sean Busbey wrote:
>>
>>> Does the IP you listed properly handle DNS resolution? You should make
>>> sure
>>> forward and reverse look up work properly for hosts used.
>>>
>>> Generally you should also configure things via host name and not IP
>>> address.
>>>
>>> On Mon, Sep 29, 2014 at 8:17 AM, SACHINGUPTA <sa...@datametica.com>
>>> wrote:
>>>
>>>   java client
>>>> package com.example.hbaseconnect.HBaseConnect;
>>>>
>>>> import java.io.IOException;
>>>>
>>>> import org.apache.hadoop.conf.Configuration;
>>>> import org.apache.hadoop.hbase.HBaseConfiguration;
>>>> import org.apache.hadoop.hbase.client.HBaseAdmin;
>>>> import org.apache.hadoop.hbase.client.HTable;
>>>> import org.apache.hadoop.hbase.client.Scan;
>>>>
>>>> public class HBaseConnect {
>>>>       public static void main(String[] args) throws IOException {
>>>>           Configuration conf = HBaseConfiguration.create();
>>>>           conf.clear();
>>>>           conf.addResource("hbase-site.xml");
>>>>           conf.set("hbase.zookeeper.quorum","10.255.1.61");
>>>>           conf.set("hbase.zookeeper.property.clientPort","2181");
>>>>           conf.set("hbase.master", "10.255.1.61:60010");
>>>>
>>>>           HBaseAdmin.checkHBaseAvailable(conf);
>>>>           System.out.println("connected to hbase");
>>>>           HTable table = new HTable(conf, "bunty");
>>>>           Scan scan = new Scan();
>>>>       }
>>>> }
>>>>
>>>>
>>>> client side hbase-site.xml
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>
>>>> <!--Autogenerated by Cloudera CM on 2014-08-28T02:35:59.408Z-->
>>>> <configuration>
>>>>     <property>
>>>>       <name>hbase.rootdir</name>
>>>>       <value>hdfs://10.255.1.61:8020/hbase</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>hbase.client.write.buffer</name>
>>>>       <value>2097152</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>hbase.client.pause</name>
>>>>       <value>1000</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>hbase.client.retries.number</name>
>>>>       <value>10</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>hbase.client.scanner.caching</name>
>>>>       <value>1</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>hbase.client.keyvalue.maxsize</name>
>>>>       <value>10485760</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>hbase.rpc.timeout</name>
>>>>       <value>60000</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>hbase.security.authentication</name>
>>>>       <value>simple</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>zookeeper.session.timeout</name>
>>>>       <value>60000</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>zookeeper.znode.parent</name>
>>>>       <value>/hbase</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>zookeeper.znode.rootserver</name>
>>>>       <value>root-region-server</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>hbase.zookeeper.quorum</name>
>>>>       <value>10.255.1.61</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>hbase.zookeeper.property.clientPort</name>
>>>>       <value>2181</value>
>>>>     </property>
>>>> </configuration>
>>>>
>>>>
>>>> On Monday 29 September 2014 06:35 PM, Wellington Chevreuil wrote:
>>>>
>>>>   Hi,
>>>>> You should not do this, as localhost should resolve to the own host.
>>>>> This
>>>>> is probably some missing property on the clients hbase configuration
>>>>> (make
>>>>> sure you have a proper hbase-site.xml on client's classpath or set
>>>>> configuration programatically). As a start, check if you had set the
>>>>> properties below on your client's hbase config.
>>>>>
>>>>>     <property>
>>>>>        <name>hbase.zookeeper.quorum</name>
>>>>>        <value>ZK_HOSTS</value>
>>>>>      </property>
>>>>>      <property>
>>>>>        <name>hbase.zookeeper.property.clientPort</name>
>>>>>        <value>2181</value>
>>>>>      </property>
>>>>>
>>>>>
>>>>> On 29 Sep 2014, at 13:43, SACHINGUPTA <sa...@datametica.com> wrote:
>>>>>
>>>>>    Hello guys
>>>>>
>>>>>> I am using the hbase java api to connect to hbase remotely, but when I
>>>>>> executed the java code, got |MasterNotRunningException|. When I
>>>>>> debugged
>>>>>> the code, I came to know that zookeeper was returning the address of
>>>>>> hmaster as localhost.localdomain, so the client was trying to search
>>>>>> for
>>>>>> the hmaster locally. When I changed the |/etc/hosts| file of my local
>>>>>> machine from where i am running the java client as:
>>>>>>
>>>>>> |<ip of the master>  localhost.localdomain|
>>>>>>
>>>>>> then it worked fine.
>>>>>>
>>>>>> However, I think that this is not the right way. I think I have to
>>>>>> change the addresses somewhere in the configuration of zookeeper, but
>>>>>> I did
>>>>>> not get it.
>>>>>>
>>>>>> please help
>>>>>> thanks
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Thanks
>>>>>> Sachin Gupta
>>>>>>
>>>>>>
>>>>>>   --
>>>> Thanks
>>>> Sachin Gupta
>>>>
>>>>
>>>>
>> --
>> Thanks
>> Sachin Gupta
>>
>>
>

-- 
Thanks
Sachin Gupta


Re: Access hbase remotely from java client

Posted by Sean Busbey <bu...@cloudera.com>.
What does the "hostname" command return on the master?

Do you have any backup-masters configured?

What is the contents of your regionservers file?

On Mon, Sep 29, 2014 at 9:55 AM, SACHINGUPTA <sa...@datametica.com> wrote:

> yes
>
> On Monday 29 September 2014 08:18 PM, Sean Busbey wrote:
>
>> Does the IP you listed properly handle DNS resolution? You should make
>> sure
>> forward and reverse look up work properly for hosts used.
>>
>> Generally you should also configure things via host name and not IP
>> address.
>>
>> On Mon, Sep 29, 2014 at 8:17 AM, SACHINGUPTA <sa...@datametica.com>
>> wrote:
>>
>>  java client
>>>
>>> package com.example.hbaseconnect.HBaseConnect;
>>>
>>> import java.io.IOException;
>>>
>>> import org.apache.hadoop.conf.Configuration;
>>> import org.apache.hadoop.hbase.HBaseConfiguration;
>>> import org.apache.hadoop.hbase.client.HBaseAdmin;
>>> import org.apache.hadoop.hbase.client.HTable;
>>> import org.apache.hadoop.hbase.client.Scan;
>>>
>>> public class HBaseConnect {
>>>      public static void main(String[] args) throws IOException {
>>>          Configuration conf = HBaseConfiguration.create();
>>>          conf.clear();
>>>          conf.addResource("hbase-site.xml");
>>>          conf.set("hbase.zookeeper.quorum","10.255.1.61");
>>>          conf.set("hbase.zookeeper.property.clientPort","2181");
>>>          conf.set("hbase.master", "10.255.1.61:60010");
>>>
>>>          HBaseAdmin.checkHBaseAvailable(conf);
>>>          System.out.println("connected to hbase");
>>>          HTable table = new HTable(conf, "bunty");
>>>          Scan scan = new Scan();
>>>      }
>>> }
>>>
>>>
>>> client side hbase-site.xml
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
>>> <!--Autogenerated by Cloudera CM on 2014-08-28T02:35:59.408Z-->
>>> <configuration>
>>>    <property>
>>>      <name>hbase.rootdir</name>
>>>      <value>hdfs://10.255.1.61:8020/hbase</value>
>>>    </property>
>>>    <property>
>>>      <name>hbase.client.write.buffer</name>
>>>      <value>2097152</value>
>>>    </property>
>>>    <property>
>>>      <name>hbase.client.pause</name>
>>>      <value>1000</value>
>>>    </property>
>>>    <property>
>>>      <name>hbase.client.retries.number</name>
>>>      <value>10</value>
>>>    </property>
>>>    <property>
>>>      <name>hbase.client.scanner.caching</name>
>>>      <value>1</value>
>>>    </property>
>>>    <property>
>>>      <name>hbase.client.keyvalue.maxsize</name>
>>>      <value>10485760</value>
>>>    </property>
>>>    <property>
>>>      <name>hbase.rpc.timeout</name>
>>>      <value>60000</value>
>>>    </property>
>>>    <property>
>>>      <name>hbase.security.authentication</name>
>>>      <value>simple</value>
>>>    </property>
>>>    <property>
>>>      <name>zookeeper.session.timeout</name>
>>>      <value>60000</value>
>>>    </property>
>>>    <property>
>>>      <name>zookeeper.znode.parent</name>
>>>      <value>/hbase</value>
>>>    </property>
>>>    <property>
>>>      <name>zookeeper.znode.rootserver</name>
>>>      <value>root-region-server</value>
>>>    </property>
>>>    <property>
>>>      <name>hbase.zookeeper.quorum</name>
>>>      <value>10.255.1.61</value>
>>>    </property>
>>>    <property>
>>>      <name>hbase.zookeeper.property.clientPort</name>
>>>      <value>2181</value>
>>>    </property>
>>> </configuration>
>>>
>>>
>>> On Monday 29 September 2014 06:35 PM, Wellington Chevreuil wrote:
>>>
>>>  Hi,
>>>>
>>>> You should not do this, as localhost should resolve to the own host.
>>>> This
>>>> is probably some missing property on the clients hbase configuration
>>>> (make
>>>> sure you have a proper hbase-site.xml on client's classpath or set
>>>> configuration programatically). As a start, check if you had set the
>>>> properties below on your client's hbase config.
>>>>
>>>>    <property>
>>>>       <name>hbase.zookeeper.quorum</name>
>>>>       <value>ZK_HOSTS</value>
>>>>     </property>
>>>>     <property>
>>>>       <name>hbase.zookeeper.property.clientPort</name>
>>>>       <value>2181</value>
>>>>     </property>
>>>>
>>>>
>>>> On 29 Sep 2014, at 13:43, SACHINGUPTA <sa...@datametica.com> wrote:
>>>>
>>>>   Hello guys
>>>>
>>>>> I am using the hbase java api to connect to hbase remotely, but when I
>>>>> executed the java code, got |MasterNotRunningException|. When I
>>>>> debugged
>>>>> the code, I came to know that zookeeper was returning the address of
>>>>> hmaster as localhost.localdomain, so the client was trying to search
>>>>> for
>>>>> the hmaster locally. When I changed the |/etc/hosts| file of my local
>>>>> machine from where i am running the java client as:
>>>>>
>>>>> |<ip of the master>  localhost.localdomain|
>>>>>
>>>>> then it worked fine.
>>>>>
>>>>> However, I think that this is not the right way. I think I have to
>>>>> change the addresses somewhere in the configuration of zookeeper, but
>>>>> I did
>>>>> not get it.
>>>>>
>>>>> please help
>>>>> thanks
>>>>>
>>>>>
>>>>> --
>>>>> Thanks
>>>>> Sachin Gupta
>>>>>
>>>>>
>>>>>  --
>>> Thanks
>>> Sachin Gupta
>>>
>>>
>>>
>>
> --
> Thanks
> Sachin Gupta
>
>


-- 
Sean

Re: Access hbase remotely from java client

Posted by SACHINGUPTA <sa...@datametica.com>.
yes
On Monday 29 September 2014 08:18 PM, Sean Busbey wrote:
> Does the IP you listed properly handle DNS resolution? You should make sure
> forward and reverse look up work properly for hosts used.
>
> Generally you should also configure things via host name and not IP address.
>
> On Mon, Sep 29, 2014 at 8:17 AM, SACHINGUPTA <sa...@datametica.com> wrote:
>
>> java client
>>
>> package com.example.hbaseconnect.HBaseConnect;
>>
>> import java.io.IOException;
>>
>> import org.apache.hadoop.conf.Configuration;
>> import org.apache.hadoop.hbase.HBaseConfiguration;
>> import org.apache.hadoop.hbase.client.HBaseAdmin;
>> import org.apache.hadoop.hbase.client.HTable;
>> import org.apache.hadoop.hbase.client.Scan;
>>
>> public class HBaseConnect {
>>      public static void main(String[] args) throws IOException {
>>          Configuration conf = HBaseConfiguration.create();
>>          conf.clear();
>>          conf.addResource("hbase-site.xml");
>>          conf.set("hbase.zookeeper.quorum","10.255.1.61");
>>          conf.set("hbase.zookeeper.property.clientPort","2181");
>>          conf.set("hbase.master", "10.255.1.61:60010");
>>
>>          HBaseAdmin.checkHBaseAvailable(conf);
>>          System.out.println("connected to hbase");
>>          HTable table = new HTable(conf, "bunty");
>>          Scan scan = new Scan();
>>      }
>> }
>>
>>
>> client side hbase-site.xml
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <!--Autogenerated by Cloudera CM on 2014-08-28T02:35:59.408Z-->
>> <configuration>
>>    <property>
>>      <name>hbase.rootdir</name>
>>      <value>hdfs://10.255.1.61:8020/hbase</value>
>>    </property>
>>    <property>
>>      <name>hbase.client.write.buffer</name>
>>      <value>2097152</value>
>>    </property>
>>    <property>
>>      <name>hbase.client.pause</name>
>>      <value>1000</value>
>>    </property>
>>    <property>
>>      <name>hbase.client.retries.number</name>
>>      <value>10</value>
>>    </property>
>>    <property>
>>      <name>hbase.client.scanner.caching</name>
>>      <value>1</value>
>>    </property>
>>    <property>
>>      <name>hbase.client.keyvalue.maxsize</name>
>>      <value>10485760</value>
>>    </property>
>>    <property>
>>      <name>hbase.rpc.timeout</name>
>>      <value>60000</value>
>>    </property>
>>    <property>
>>      <name>hbase.security.authentication</name>
>>      <value>simple</value>
>>    </property>
>>    <property>
>>      <name>zookeeper.session.timeout</name>
>>      <value>60000</value>
>>    </property>
>>    <property>
>>      <name>zookeeper.znode.parent</name>
>>      <value>/hbase</value>
>>    </property>
>>    <property>
>>      <name>zookeeper.znode.rootserver</name>
>>      <value>root-region-server</value>
>>    </property>
>>    <property>
>>      <name>hbase.zookeeper.quorum</name>
>>      <value>10.255.1.61</value>
>>    </property>
>>    <property>
>>      <name>hbase.zookeeper.property.clientPort</name>
>>      <value>2181</value>
>>    </property>
>> </configuration>
>>
>>
>> On Monday 29 September 2014 06:35 PM, Wellington Chevreuil wrote:
>>
>>> Hi,
>>>
>>> You should not do this, as localhost should resolve to the own host. This
>>> is probably some missing property on the clients hbase configuration (make
>>> sure you have a proper hbase-site.xml on client's classpath or set
>>> configuration programatically). As a start, check if you had set the
>>> properties below on your client's hbase config.
>>>
>>>    <property>
>>>       <name>hbase.zookeeper.quorum</name>
>>>       <value>ZK_HOSTS</value>
>>>     </property>
>>>     <property>
>>>       <name>hbase.zookeeper.property.clientPort</name>
>>>       <value>2181</value>
>>>     </property>
>>>
>>>
>>> On 29 Sep 2014, at 13:43, SACHINGUPTA <sa...@datametica.com> wrote:
>>>
>>>   Hello guys
>>>> I am using the hbase java api to connect to hbase remotely, but when I
>>>> executed the java code, got |MasterNotRunningException|. When I debugged
>>>> the code, I came to know that zookeeper was returning the address of
>>>> hmaster as localhost.localdomain, so the client was trying to search for
>>>> the hmaster locally. When I changed the |/etc/hosts| file of my local
>>>> machine from where i am running the java client as:
>>>>
>>>> |<ip of the master>  localhost.localdomain|
>>>>
>>>> then it worked fine.
>>>>
>>>> However, I think that this is not the right way. I think I have to
>>>> change the addresses somewhere in the configuration of zookeeper, but I did
>>>> not get it.
>>>>
>>>> please help
>>>> thanks
>>>>
>>>>
>>>> --
>>>> Thanks
>>>> Sachin Gupta
>>>>
>>>>
>> --
>> Thanks
>> Sachin Gupta
>>
>>
>

-- 
Thanks
Sachin Gupta


Re: Access hbase remotely from java client

Posted by Sean Busbey <bu...@cloudera.com>.
Does the IP you listed properly handle DNS resolution? You should make sure
forward and reverse look up work properly for hosts used.

Generally you should also configure things via host name and not IP address.

On Mon, Sep 29, 2014 at 8:17 AM, SACHINGUPTA <sa...@datametica.com> wrote:

> java client
>
> package com.example.hbaseconnect.HBaseConnect;
>
> import java.io.IOException;
>
> import org.apache.hadoop.conf.Configuration;
> import org.apache.hadoop.hbase.HBaseConfiguration;
> import org.apache.hadoop.hbase.client.HBaseAdmin;
> import org.apache.hadoop.hbase.client.HTable;
> import org.apache.hadoop.hbase.client.Scan;
>
> public class HBaseConnect {
>     public static void main(String[] args) throws IOException {
>         Configuration conf = HBaseConfiguration.create();
>         conf.clear();
>         conf.addResource("hbase-site.xml");
>         conf.set("hbase.zookeeper.quorum","10.255.1.61");
>         conf.set("hbase.zookeeper.property.clientPort","2181");
>         conf.set("hbase.master", "10.255.1.61:60010");
>
>         HBaseAdmin.checkHBaseAvailable(conf);
>         System.out.println("connected to hbase");
>         HTable table = new HTable(conf, "bunty");
>         Scan scan = new Scan();
>     }
> }
>
>
> client side hbase-site.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!--Autogenerated by Cloudera CM on 2014-08-28T02:35:59.408Z-->
> <configuration>
>   <property>
>     <name>hbase.rootdir</name>
>     <value>hdfs://10.255.1.61:8020/hbase</value>
>   </property>
>   <property>
>     <name>hbase.client.write.buffer</name>
>     <value>2097152</value>
>   </property>
>   <property>
>     <name>hbase.client.pause</name>
>     <value>1000</value>
>   </property>
>   <property>
>     <name>hbase.client.retries.number</name>
>     <value>10</value>
>   </property>
>   <property>
>     <name>hbase.client.scanner.caching</name>
>     <value>1</value>
>   </property>
>   <property>
>     <name>hbase.client.keyvalue.maxsize</name>
>     <value>10485760</value>
>   </property>
>   <property>
>     <name>hbase.rpc.timeout</name>
>     <value>60000</value>
>   </property>
>   <property>
>     <name>hbase.security.authentication</name>
>     <value>simple</value>
>   </property>
>   <property>
>     <name>zookeeper.session.timeout</name>
>     <value>60000</value>
>   </property>
>   <property>
>     <name>zookeeper.znode.parent</name>
>     <value>/hbase</value>
>   </property>
>   <property>
>     <name>zookeeper.znode.rootserver</name>
>     <value>root-region-server</value>
>   </property>
>   <property>
>     <name>hbase.zookeeper.quorum</name>
>     <value>10.255.1.61</value>
>   </property>
>   <property>
>     <name>hbase.zookeeper.property.clientPort</name>
>     <value>2181</value>
>   </property>
> </configuration>
>
>
> On Monday 29 September 2014 06:35 PM, Wellington Chevreuil wrote:
>
>> Hi,
>>
>> You should not do this, as localhost should resolve to the own host. This
>> is probably some missing property on the clients hbase configuration (make
>> sure you have a proper hbase-site.xml on client's classpath or set
>> configuration programatically). As a start, check if you had set the
>> properties below on your client's hbase config.
>>
>>   <property>
>>      <name>hbase.zookeeper.quorum</name>
>>      <value>ZK_HOSTS</value>
>>    </property>
>>    <property>
>>      <name>hbase.zookeeper.property.clientPort</name>
>>      <value>2181</value>
>>    </property>
>>
>>
>> On 29 Sep 2014, at 13:43, SACHINGUPTA <sa...@datametica.com> wrote:
>>
>>  Hello guys
>>>
>>> I am using the hbase java api to connect to hbase remotely, but when I
>>> executed the java code, got |MasterNotRunningException|. When I debugged
>>> the code, I came to know that zookeeper was returning the address of
>>> hmaster as localhost.localdomain, so the client was trying to search for
>>> the hmaster locally. When I changed the |/etc/hosts| file of my local
>>> machine from where i am running the java client as:
>>>
>>> |<ip of the master>  localhost.localdomain|
>>>
>>> then it worked fine.
>>>
>>> However, I think that this is not the right way. I think I have to
>>> change the addresses somewhere in the configuration of zookeeper, but I did
>>> not get it.
>>>
>>> please help
>>> thanks
>>>
>>>
>>> --
>>> Thanks
>>> Sachin Gupta
>>>
>>>
>>
> --
> Thanks
> Sachin Gupta
>
>


-- 
Sean

Re: Access hbase remotely from java client

Posted by SACHINGUPTA <sa...@datametica.com>.
java client

package com.example.hbaseconnect.HBaseConnect;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Scan;

public class HBaseConnect {
     public static void main(String[] args) throws IOException {
         Configuration conf = HBaseConfiguration.create();
         conf.clear();
         conf.addResource("hbase-site.xml");
         conf.set("hbase.zookeeper.quorum","10.255.1.61");
         conf.set("hbase.zookeeper.property.clientPort","2181");
         conf.set("hbase.master", "10.255.1.61:60010");

         HBaseAdmin.checkHBaseAvailable(conf);
         System.out.println("connected to hbase");
         HTable table = new HTable(conf, "bunty");
         Scan scan = new Scan();
     }
}


client side hbase-site.xml

<?xml version="1.0" encoding="UTF-8"?>

<!--Autogenerated by Cloudera CM on 2014-08-28T02:35:59.408Z-->
<configuration>
   <property>
     <name>hbase.rootdir</name>
     <value>hdfs://10.255.1.61:8020/hbase</value>
   </property>
   <property>
     <name>hbase.client.write.buffer</name>
     <value>2097152</value>
   </property>
   <property>
     <name>hbase.client.pause</name>
     <value>1000</value>
   </property>
   <property>
     <name>hbase.client.retries.number</name>
     <value>10</value>
   </property>
   <property>
     <name>hbase.client.scanner.caching</name>
     <value>1</value>
   </property>
   <property>
     <name>hbase.client.keyvalue.maxsize</name>
     <value>10485760</value>
   </property>
   <property>
     <name>hbase.rpc.timeout</name>
     <value>60000</value>
   </property>
   <property>
     <name>hbase.security.authentication</name>
     <value>simple</value>
   </property>
   <property>
     <name>zookeeper.session.timeout</name>
     <value>60000</value>
   </property>
   <property>
     <name>zookeeper.znode.parent</name>
     <value>/hbase</value>
   </property>
   <property>
     <name>zookeeper.znode.rootserver</name>
     <value>root-region-server</value>
   </property>
   <property>
     <name>hbase.zookeeper.quorum</name>
     <value>10.255.1.61</value>
   </property>
   <property>
     <name>hbase.zookeeper.property.clientPort</name>
     <value>2181</value>
   </property>
</configuration>

On Monday 29 September 2014 06:35 PM, Wellington Chevreuil wrote:
> Hi,
>
> You should not do this, as localhost should resolve to the own host. This is probably some missing property on the clients hbase configuration (make sure you have a proper hbase-site.xml on client's classpath or set configuration programatically). As a start, check if you had set the properties below on your client's hbase config.
>
>   <property>
>      <name>hbase.zookeeper.quorum</name>
>      <value>ZK_HOSTS</value>
>    </property>
>    <property>
>      <name>hbase.zookeeper.property.clientPort</name>
>      <value>2181</value>
>    </property>
>
>
> On 29 Sep 2014, at 13:43, SACHINGUPTA <sa...@datametica.com> wrote:
>
>> Hello guys
>>
>> I am using the hbase java api to connect to hbase remotely, but when I executed the java code, got |MasterNotRunningException|. When I debugged the code, I came to know that zookeeper was returning the address of hmaster as localhost.localdomain, so the client was trying to search for the hmaster locally. When I changed the |/etc/hosts| file of my local machine from where i am running the java client as:
>>
>> |<ip of the master>  localhost.localdomain|
>>
>> then it worked fine.
>>
>> However, I think that this is not the right way. I think I have to change the addresses somewhere in the configuration of zookeeper, but I did not get it.
>>
>> please help
>> thanks
>>
>>
>> -- 
>> Thanks
>> Sachin Gupta
>>
>

-- 
Thanks
Sachin Gupta


Re: Access hbase remotely from java client

Posted by Wellington Chevreuil <we...@gmail.com>.
Hi,

You should not do this, as localhost should resolve to the own host. This is probably some missing property on the clients hbase configuration (make sure you have a proper hbase-site.xml on client's classpath or set configuration programatically). As a start, check if you had set the properties below on your client's hbase config. 

 <property>
    <name>hbase.zookeeper.quorum</name>
    <value>ZK_HOSTS</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2181</value>
  </property>


On 29 Sep 2014, at 13:43, SACHINGUPTA <sa...@datametica.com> wrote:

> Hello guys
> 
> I am using the hbase java api to connect to hbase remotely, but when I executed the java code, got |MasterNotRunningException|. When I debugged the code, I came to know that zookeeper was returning the address of hmaster as localhost.localdomain, so the client was trying to search for the hmaster locally. When I changed the |/etc/hosts| file of my local machine from where i am running the java client as:
> 
> |<ip of the master>  localhost.localdomain|
> 
> then it worked fine.
> 
> However, I think that this is not the right way. I think I have to change the addresses somewhere in the configuration of zookeeper, but I did not get it.
> 
> please help
> thanks
> 
> 
> -- 
> Thanks
> Sachin Gupta
>