0
  • I have HBase in a windows machine.
  • I try to access the same from another windows machine via java program.
  • Results with Connection refused error.

Note:

  • I tried the same in Linux which worked perfectly. Where I had HBase in Linux machine and access it from windows machine via java. Problem occurs only when I try to access windows HBase, either from Linux or from windows

hbase-env.sh:

The below two lines are uncommented;

set HBASE_MANAGES_ZK=true

set JAVA_HOME=C:\jdk

hbase-site.xml:

<configuration>
    <property>
        <name>hbase.rootdir</name>
        <value>D:\hbaseInstalledPath</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>D:\zookeeperDataDirPath</value>
    </property>
    <property>
        <name>hbase.zookeeper.recoverable.waittime</name>
        <value>30000</value>
    </property>
    <property>
        <name>zookeeper.session.timeout</name>
        <value>180000</value>
    </property>
    <property>
        <name>hbase.master</name>
        <value>'HBase running IP'</value>
    </property>
    <property>
        <name>hbase.cluster.distributed</name>
        <value>false</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.clientPort</name>
        <value>2181</value>
    </property>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>'HBase running IP' , 'JavaClient IP'</value>
    </property>
</configuration>

Java code:

HConnection connection=null;
Configuration config=HBaseConfiguration.create();
config.clear();
config.set("hbase.zookeeper.quorum","172.16.101.82");
config.set("hbase.zookeeper.property.clientPort","2181");
try {
connection=HConnectionManager.createConnection(config);
}
catch(Exception e)
{ }
try {
HTableInterface table=connection.getTable(TableName.valueOf("sample"));
}
catch(Exception e)
{ }

Exception:

Exception in connection creationorg.apache.hadoop.hbase.MasterNotRunningException: 
com.google.protobuf.ServiceException: org.apache.hadoop.net.ConnectTimeoutException:
20000 millis timeout while waiting for channel to be ready for connect. ch : 
java.nio.channels.SocketChannel[connection-pending 
remote=synclapn4948/172.16.101.82:54422]
Farvardin
  • 5,336
  • 5
  • 33
  • 54
Dinesh Kumar P
  • 1,128
  • 2
  • 18
  • 32
  • 1
    Can you check the firewall rules in windows machine. – Amal G Jose Dec 01 '14 at 11:59
  • Yes, firewall is turned off; Yet same problem. – Dinesh Kumar P Dec 01 '14 at 12:49
  • Are you sure the ZooKeeper really is running? You might need to explicitly start it. You can check with "netstat -an" (I think). – juwi Dec 02 '14 at 10:15
  • I checked that too; Using netstat, zookeeper port **2181** status is displayed as ***ESTABLISHED*** – Dinesh Kumar P Dec 02 '14 at 11:12
  • 1
    To clarify. 'hbase.zookeeper.quorum' should be all IPs/Hosts on which ZooKeeper is running. So if you have it running on the HBase node itself, as well as on the client, from which you are trying to connect, the config above is fine. In this case it cannot find a master. In that case you should check on the ZooKeeper, itself using the zkCli. A "get /hbase/master" should give you the master status if you're running with default config. If this yields an error, try with an "ls" if there are other hbase listings. If there are however no records for the master, this is where the problem is. – juwi Dec 02 '14 at 12:02
  • Could you please clarify the below, **"So if you have it running on the HBase node itself, as well as on the client, from which you are trying to connect, the config above is fine. In this case it cannot find a master."** You ask us to configure zookeeper in both HBase Master machine and Java client Machine? If yes, how could zookeeper present in Java client Machine would know about HBase Master? – Dinesh Kumar P Dec 02 '14 at 12:24
  • 1
    No, you state the following in your hbase-site.xml: hbase.zookeeper.quorum 'HBase running IP' , 'JavaClient IP' I'm saying that the value **should be** the zookeeper nodes and nothing else. If your ZooKeeper is running on "HBase running IP" and 'JacaClient IP' then this is fine. I just wanted to rule out that you misunderstood the "hbase.zookeeper.quorum" value. – juwi Dec 02 '14 at 12:52
  • Zookeeper is running on "HBase running IP" alone and its mentioned in 'hbase.zookeeper.quorum' property too; And we also tried running ZOokeeper in 'JavaClient Machine'; In **both** cases we still face same connection refused error :( – Dinesh Kumar P Dec 03 '14 at 05:52
  • 1
    Have you checked in ZooKeeper directly using zkCli, as I wrote? – juwi Dec 03 '14 at 08:23
  • Will check and let you know :) – Dinesh Kumar P Dec 03 '14 at 08:42

0 Answers0