Hbase程序访问问题

大家好,我最近在做Hbase的项目,我就想再自己开发机器上安装了一个虚拟机,red_hat5,hbase-0.90.5.tar,部署了一个单间版的hbase,自己做一些小测试!! 在linux下,安装都正常。问题我程序一访问就连接不上。在linux下,用hbase shell都可以正常在。

代码如下:

static {
Configuration HBASE_CONFIG = new Configuration();
HBASE_CONFIG.set("hbase.zookeeper.quorum", "192.168.1.120");
HBASE_CONFIG.set("hbase.zookeeper.property.clientPort", "2181");
conf = HBaseConfiguration.create(HBASE_CONFIG);
}


//creatTable
public static void creatTable(String tableName, String[] familys) throws Exception {

HBaseAdmin admin = new HBaseAdmin(conf);

if (admin.tableExists(tableName)) {

System.out.println("table already exists!");

} else {

HTableDescriptor tableDesc = new HTableDescriptor(tableName);

for(int i=0; i

tableDesc.addFamily(new HColumnDescriptor(familys));

}

admin.createTable(tableDesc);

System.out.println("create table " + tableName + " ok.");

}

}


public static void main (String [] agrs) {


String tablename = "scores";

String[] familys = {"grade", "course"};

HBaseTest.creatTable(tablename, familys);

}

异常:


java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)
at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:656)
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:359)
at org.apache.hadoop.hbase.client.HBaseAdmin.(HBaseAdmin.java:89)
at HBaseTest.creatTable(HBaseTest.java:82)
at HBaseTest.main(HBaseTest.java:280)
12/11/29 23:54:58 INFO client.HConnectionManager$HConnectionImplementation: getMaster attempt 1 of 10 failed; retrying after sleep of 1000
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)
at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:656)
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:359)
at org.apache.hadoop.hbase.client.HBaseAdmin.(HBaseAdmin.java:89)
at HBaseTest.creatTable(HBaseTest.java:82)
at HBaseTest.main(HBaseTest.java:280)
大家遇到过这个问题吗?

非常感谢banq的回答,防火墙都关闭了啊,service iptables stop 我就纳闷了,都纠结好久了。难道我只安装hbase要试试也不行吗?不会是这样的吧,可能还是哪里没有搞好,难道我xp系统问题,但是我公司的电话,我也安装了,但是还是这个是结果。
zookeeper.RecoverableZooKeeper: The identifier of this process is 4264@69389f07cb73457
12/12/02 22:07:37 WARN client.ZooKeeperSaslClient: SecurityException: java.lang.SecurityException: 无法定位登录配置 occurred when trying to find JAAS configuration.
12/12/02 22:07:37 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
12/12/02 22:07:37 INFO zookeeper.ClientCnxn: Socket connection established to node0/192.168.1.120:2181, initiating session
12/12/02 22:07:37 WARN zookeeper.ClientCnxnSocket: Connected to an old server; r-o mode will be unavailable
12/12/02 22:07:37 INFO zookeeper.ClientCnxn: Session establishment complete on server node0/192.168.1.120:2181, sessionid = 0x13b506c0abc0005, negotiated timeout = 40000
12/12/02 22:07:38 INFO client.HConnectionManager$HConnectionImplementation: getMaster attempt 0 of 10 failed; retrying after sleep of 1000
2012-12-02 22:02 "@javawebkaifa"的内容
: SecurityException: java.lang.SecurityException: 无法定位登录配置 occurred when trying to find JAAS configuration ...

JAAS配置不正确,任何一个环节出问题都报此错误,用户名和密码错误也会报。

真的有点崩溃了!!!
main-SendThread()[INFO 2012-12-03 13:54:15 ClientCnxn$SendThread:startConnect] - Opening socket connection to server /192.168.1.250:2181
main-SendThread(localhost.localdomain:2181)[INFO 2012-12-03 13:54:15 ClientCnxn$SendThread:primeConnection] - Socket connection established to localhost.localdomain/192.168.1.250:2181, initiating session
main-SendThread(localhost.localdomain:2181)[INFO 2012-12-03 13:54:15 ClientCnxn$SendThread:onConnected] - Session establishment complete on server localhost.localdomain/192.168.1.250:2181, sessionid = 0x14b8b645ae50003, negotiated timeout = 40000
java.lang.IllegalArgumentException: Not a host:port pair: ?