无法从 Windows 连接到 HBase

Posted

技术标签:

【中文标题】无法从 Windows 连接到 HBase【英文标题】:Not able to connect to HBase from Windows 【发布时间】:2013-09-27 22:40:39 【问题描述】:

我正在尝试从 Windows 运行 HBase Java 客户端程序。 我所拥有的是 1) 一个没有任何编译器错误的 Java 程序 2) hbase-site.xml (我没有其他 HDFS 或 HBase 配置文件。只有上述一个。) 当我运行程序时,我在最后一个块中得到以下错误。我错过了什么吗? 两者我都在这里。

<?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

【问题讨论】:

我按照***.com/questions/17184705/… 此处给出的步骤进行操作,现在没有例外,但在 HTable aTable = new HTable(aConfig, "TestTable"); 处无限期等待; 【参考方案1】:

我没有 core-site.xml,后来我遇到了一些连接问题 到 HDFS 名称节点。一旦我解决了这些问题,我就可以插入数据了。

在我开发将数据插入 HBase 的客户端程序时,我还解决了以下依赖项: commons-lang-2.6 公共日志记录-1.1.3 slf4j-1.7.5 protobuf-java-2.4.0a .

【讨论】:

以上是关于无法从 Windows 连接到 HBase的主要内容,如果未能解决你的问题,请参考以下文章

无法从 Windows 连接到 HBase

詹金斯:无法将奴隶连接到主人

无法从 Vista x64 Windows 服务连接到 SQL Server 2005 Db

从 Windows 10 上的网络共享运行的应用程序无法连接到 SQL Server

phpMyAdmin 无法从 Linux 客户端连接到 Windows 7 上的远程服务器

无法通过 ODBC 从 Windows 10 连接到 Linux MySQL DB