5

嗨,我在完全分布式模式下使用 hBase,我正在尝试使用 java 代码连接 Hbase 并创建一个表。我得到一个错误。它没有连接到hbase。我检查了它们运行良好的所有进程:-namenode、datanode、nodemanager、资源管理器、hbase master、hbase regionservers、zookeeper。

错误

starting...
getting config...
12/07/25 18:48:31 WARN hbase.HBaseConfiguration: instantiating HBaseConfiguration() is deprecated. Please use HBaseConfiguration#create() to construct a plain Configuration
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 GMT
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:host.name=aniket
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:java.version=1.7.0_05
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:java.home=/usr/java/jdk1.7.0_05/jre
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:java.class.path=/root/workspace/HBaseTesting/bin:/usr/lib/hadoop-0.20-mapreduce/hadoop-core.jar:/usr/lib/hadoop/hadoop-common.jar:/root/Downloads/google-collect-1.0-rc1/google-collect-1.0-rc1.jar:/root/Downloads/hbase-0.90.5/hbase-0.90.5.jar:/root/Downloads/hbase-0.90.5/lib/activation-1.1.jar:/root/Downloads/hbase-0.90.5/lib/asm-3.1.jar:/root/Downloads/hbase-0.90.5/lib/avro-1.3.3.jar:/root/Downloads/hbase-0.90.5/lib/commons-cli-1.2.jar:/root/Downloads/hbase-0.90.5/lib/commons-codec-1.4.jar:/root/Downloads/hbase-0.90.5/lib/commons-el-1.0.jar:/root/Downloads/hbase-0.90.5/lib/commons-httpclient-3.1.jar:/root/Downloads/hbase-0.90.5/lib/commons-lang-2.5.jar:/root/Downloads/hbase-0.90.5/lib/commons-logging-1.1.1.jar:/root/Downloads/hbase-0.90.5/lib/commons-net-1.4.1.jar:/root/Downloads/hbase-0.90.5/lib/core-3.1.1.jar:/root/Downloads/hbase-0.90.5/lib/guava-r06.jar:/root/Downloads/hbase-0.90.5/lib/hadoop-core-0.20-append-r1056497.jar:/root/Downloads/hbase-0.90.5/lib/jackson-core-asl-1.5.5.jar:/root/Downloads/hbase-0.90.5/lib/jackson-jaxrs-1.5.5.jar:/root/Downloads/hbase-0.90.5/lib/jackson-mapper-asl-1.4.2.jar:/root/Downloads/hbase-0.90.5/lib/jackson-xc-1.5.5.jar:/root/Downloads/hbase-0.90.5/lib/jasper-compiler-5.5.23.jar:/root/Downloads/hbase-0.90.5/lib/jasper-runtime-5.5.23.jar:/root/Downloads/hbase-0.90.5/lib/jaxb-api-2.1.jar:/root/Downloads/hbase-0.90.5/lib/jaxb-impl-2.1.12.jar:/root/Downloads/hbase-0.90.5/lib/jersey-core-1.4.jar:/root/Downloads/hbase-0.90.5/lib/jersey-json-1.4.jar:/root/Downloads/hbase-0.90.5/lib/jersey-server-1.4.jar:/root/Downloads/hbase-0.90.5/lib/jettison-1.1.jar:/root/Downloads/hbase-0.90.5/lib/jetty-6.1.26.jar:/root/Downloads/hbase-0.90.5/lib/jetty-util-6.1.26.jar:/root/Downloads/hbase-0.90.5/lib/jruby-complete-1.6.0.jar:/root/Downloads/hbase-0.90.5/lib/jsp-2.1-6.1.14.jar:/root/Downloads/hbase-0.90.5/lib/jsp-api-2.1-6.1.14.jar:/root/Downloads/hbase-0.90.5/lib/jsr311-api-1.1.1.jar:/root/Downloads/hbase-0.90.5/lib/log4j-1.2.16.jar:/root/Downloads/hbase-0.90.5/lib/protobuf-java-2.3.0.jar:/root/Downloads/hbase-0.90.5/lib/servlet-api-2.5-6.1.14.jar:/root/Downloads/hbase-0.90.5/lib/slf4j-api-1.5.8.jar:/root/Downloads/hbase-0.90.5/lib/slf4j-log4j12-1.5.8.jar:/root/Downloads/hbase-0.90.5/lib/stax-api-1.0.1.jar:/root/Downloads/hbase-0.90.5/lib/thrift-0.2.0.jar:/root/Downloads/hbase-0.90.5/lib/xmlenc-0.52.jar:/root/Downloads/hbase-0.90.5/lib/zookeeper-3.3.2.jar:/root/Downloads/hbql-0.90.0.1/hbql-0.90.0.1.jar
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:os.version=2.6.18-274.el5xen
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:user.name=root
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:user.home=/root
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Client environment:user.dir=/root/workspace/HBaseTesting
12/07/25 18:48:32 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=192.168.1.88:2181 sessionTimeout=180000 watcher=hconnection
12/07/25 18:48:32 INFO zookeeper.ClientCnxn: Opening socket connection to server /192.168.1.88:2181
12/07/25 18:48:32 INFO zookeeper.ClientCnxn: Socket connection established to aniket/192.168.1.88:2181, initiating session
12/07/25 18:48:32 INFO zookeeper.ClientCnxn: Session establishment complete on server aniket/192.168.1.88:2181, sessionid = 0x138bf7676070043, negotiated timeout = 40000
Exception in thread "main" java.lang.IllegalArgumentException: Not a host:port pair: �
at org.apache.hadoop.hbase.HServerAddress.<init>(HServerAddress.java:60)
    at org.apache.hadoop.hbase.MasterAddressTracker.getMasterAddress(MasterAddressTracker.java:63)
    at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:561)
    at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:99)
    at org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.java:1320)
    at HBaseCreateTable.main(HBaseCreateTable.java:38)

代码片段

Configuration config=HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", "192.168.1.88");
config.set("hbase.zookeeper.property.clientPort","2181");
config.set("hbase.master", "192.168.1.88:60000");
HTableDescriptor ht = new HTableDescriptor( "abc" );
ht.addFamily( new HColumnDescriptor( "number" ) ); // from and to
HBaseAdmin hba = new HBaseAdmin( conf );
hba.createTable( ht );
4

4 回答 4

9

我在使用 0.90.2 客户端与 0.92 服务器通信时看到“不是主机:端口对”。您能否验证您的客户端和服务器 HBase 版本是否相同,它们是什么?

于 2012-08-02T20:52:13.703 回答
0

我遇到了同样的问题,试试:

更改您正在使用的构建路径 jar/wars,使其与 Hbase 服务器版本兼容。使用相同版本的 Hbase 服务器和用于编码的 jar。例如:如果您使用的是 Hbase 0.90.2 服务器,请使用相同版本的 jars。

于 2012-08-24T10:05:35.593 回答
0

看一下这个

如果你尝试在 hbase client 0.90.x 和 hbase server 0.92.x 之间进行通信,就会出现这种问题。

如果有人详细了解此问题,请评论其原因。

于 2012-08-24T18:25:02.373 回答
0

除了沃尔特所说的。这不仅仅是因为他提到的“0.90.2”这个特定版本,事实上,只要客户端 API 和服务器 API 的版本不匹配,你就会得到这个异常。

因为我有同样的例外: -

“线程“主”java.lang.IllegalArgumentException 中的异常:不是主机:端口对:PBUF”

当我使用 0.94 的客户端 API 和 0.98 版本的服务器 API 时。

于 2015-01-15T09:26:44.023 回答