hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Busbey <bus...@cloudera.com>
Subject Re: Access hbase remotely from java client
Date Mon, 29 Sep 2014 15:08:07 GMT
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 <sachin@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 <sachin@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 <sachin@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message