Not able to connect to HBase from Windows

安稳与你 提交于 2020-01-05 07:22:11

问题


I am trying to run a HBase Java Client Program from Windows. All I have is 1) A Java Program without any compiler error 2) hbase-site.xml (No other HDFS or HBase config files I have. Only the above one.) When I run the program I get the following error-given in the last block. Do I miss something? Both I am giving here.

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>IP Address1,IPAddress2,IPAddress3</value>    
    </property>
</configuration>

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;
import java.io.IOException;


public class HConnect 
{
    public static void main(String[] args) 
    {
        try
        {
            Configuration   aConfig = HBaseConfiguration.create();
            HTable          aTable  = new HTable(aConfig, "TestTable");

            byte[]          aRowKey = Bytes.toBytes("RowKey1");
            Put             aPut    = new Put(aRowKey);

            byte[]          aColFamily  = Bytes.toBytes("ColumnFamily1");
            byte[]          aColumn     = Bytes.toBytes("Column1");
            byte[]          aColumnVal  = Bytes.toBytes("ColumnValue1");

            aPut.add(aColFamily, aColumn, aColumnVal);

            aTable.put(aPut);
            aTable.close();
        }
        catch(IOException aException_in)
        {
            System.out.println("");
        }
    }
}



 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
   Sep 27, 2013 3:16:13 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper <init>
   INFO: The identifier of this process is 7948@sisavip5-600b
   Sep 27, 2013 3:16:15 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper        retryOrThrow
   WARNING: Possibly transient ZooKeeper exception:   org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode =   ConnectionLoss for /hbase/hbaseid
    Sep 27, 2013 3:16:15 PM org.apache.hadoop.hbase.util.RetryCounter sleepUntilNextRetry
    INFO: Sleeping 2000ms before retry #1...
    Sep 27, 2013 3:16:18 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper  retryOrThrow
    WARNING: Possibly transient ZooKeeper exception:  org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode =      ConnectionLoss for /hbase/hbaseid
    Sep 27, 2013 3:16:18 PM org.apache.hadoop.hbase.util.RetryCounter sleepUntilNextRetry
    INFO: Sleeping 4000ms before retry #2...
    Sep 27, 2013 3:16:22 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper    retryOrThrow
    WARNING: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode =  ConnectionLoss for /hbase/hbaseid
    Sep 27, 2013 3:16:22 PM org.apache.hadoop.hbase.util.RetryCounter sleepUntilNextRetry
    INFO: Sleeping 8000ms before retry #3...
    Sep 27, 2013 3:16:31 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper   retryOrThrow
    WARNING: Possibly transient ZooKeeper exception:  org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode =  ConnectionLoss for /hbase/hbaseid
    Sep 27, 2013 3:16:31 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper retryOrThrow
    SEVERE: ZooKeeper exists failed after 3 retries
    Sep 27, 2013 3:16:31 PM org.apache.hadoop.hbase.zookeeper.ZKUtil checkExists
    WARNING: hconnection Unable to set watcher on znode (/hbase/hbaseid)
        org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode =       ConnectionLoss for /hbase/hbaseid

回答1:


I did not have core-site.xml and later I had some connectivity issues to the HDFS name node. Once I solved these I am able to insert data.

Also I resolved the following dependencies while I developed the client program that inserts data into HBase: commons-lang-2.6 commons-logging-1.1.3 slf4j-1.7.5 protobuf-java-2.4.0a .



来源:https://stackoverflow.com/questions/19061206/not-able-to-connect-to-hbase-from-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!