从 java 客户端从远程连接到 HBase 服务器时,我遇到了一个非常奇怪的异常。奇怪的是,我的这个 HBase 服务器工作正常,我已经用它做了很多工作,而我所做的所有工作都是通过远程连接。但是今天这个服务器搞砸了我,我不知道为什么。我检查了 Hbase 的日志,但没有发现任何异常,当我在 HBase 服务器上运行 jps 时,我发现所有进程都运行良好。那么问题是什么?我也格式化了Namenode,但问题仍然存在。下面给出了从我的 java 客户端连接到 HBase 服务器时出现的异常:
Hbase Demo Application
12/05/16 14:22:52 WARN hbase.HBaseConfiguration: instantiating HBaseConfiguration() is deprecated. Please use HBaseConfiguration#create() to construct a plain Configuration
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 GMT
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:host.name=aliraza-desktop
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:java.version=1.6.0_26
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Sun Microsystems Inc.
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:java.home=/usr/lib/jvm/java-6-sun-1.6.0.26/jre
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:java.class.path=.:/opt/COM/hbase-0.90.4/hbase-0.90.4.jar:/opt/COM/hbase-0.90.4/lib/commons-cli-1.2.jar:hadoop-core-0.20.205.0.jar:/opt/COM/hbase-0.90.4/lib/log4j-1.2.16.jar:/opt/COM/hbase-0.90.4/lib/slf4j-log4j12-1.5.8.jar:/opt/COM/hbase-0.90.4/lib/slf4j-api-1.5.8.jar:/opt/COM/hbase-0.90.4/lib/commons-logging-1.1.1.jar:/opt/COM/hbase-0.90.4/lib/zookeeper-3.3.2.jar
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:os.arch=i386
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:os.version=2.6.32-21-generic
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:user.name=COM
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:user.home=/home/COM
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Client environment:user.dir=/opt/COM/hbase-sample
12/05/16 14:22:53 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=192.168.15.20:2181 sessionTimeout=180000 watcher=hconnection
12/05/16 14:22:53 INFO zookeeper.ClientCnxn: Opening socket connection to server /192.168.15.20:2181
12/05/16 14:22:53 INFO zookeeper.ClientCnxn: Socket connection established to hbase/192.168.15.20:2181, initiating session
12/05/16 14:22:53 INFO zookeeper.ClientCnxn: Session establishment complete on server hbase/192.168.15.20:2181, sessionid = 0x13754f410eb0003, negotiated timeout = 180000
12/05/16 14:22:53 INFO client.HConnectionManager$HConnectionImplementation: getMaster attempt 0 of 1 failed; no more retrying.
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:604)
at org.apache.hadoop.hbase.ipc.HBaseClient$Connection.setupIOstreams(HBaseClient.java:328)
at org.apache.hadoop.hbase.ipc.HBaseClient.getConnection(HBaseClient.java:883)
at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:750)
at org.apache.hadoop.hbase.ipc.HBaseRPC$Invoker.invoke(HBaseRPC.java:257)
at $Proxy4.getProtocolVersion(Unknown Source)
at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:419)
at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:393)
at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:444)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:360)
at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:94)
at org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.java:1258)
at HBaseDemo.main(HBaseDemo.java:55)
HBase is not running!
Execution script exiting
我真的被困在那里。