[mw_shl_code=java,true] Configuration HBASE_CONFIG = new Configuration();
HBASE_CONFIG.set("hbase.master", "192.168.3.66:60000");
HBASE_CONFIG.set("hbase.zookeeper.quorum", "192.168.3.66,192.168.3.67");
HBASE_CONFIG.set("hbase.zookeeper.property.clientPort", "2181");
Configuration conf = null;
conf = HBaseConfiguration.create(HBASE_CONFIG);
Connection connection = ConnectionFactory.createConnection(conf);
Table table = connection.getTable(TableName.valueOf("t"));
Get g = new Get(Bytes.toBytes("lishi"));
g.addFamily(Bytes.toBytes("cf:age"));
if(table.exists(g)){
System.out.println("exist");
}else
System.out.println("none");[/mw_shl_code]
打印出来的日志如下:
[mw_shl_code=java,true]2016-02-03 09:35:09,024 INFO zookeeper.ZooKeeper (ZooKeeper.java:<init>(438)) - Initiating client connection, connectString=192.168.3.66:2181,192.168.3.67:2181 sessionTimeout=90000 watcher=hconnection-0x1b1d8960x0, quorum=192.168.3.66:2181,192.168.3.67:2181, baseZNode=/hbase
2016-02-03 09:35:09,274 INFO zookeeper.ClientCnxn (ClientCnxn.java:logStartConnect(975)) - Opening socket connection to server 192.168.3.67/192.168.3.67:2181. Will not attempt to authenticate using SASL (unknown error)
2016-02-03 09:35:09,274 INFO zookeeper.ClientCnxn (ClientCnxn.java:primeConnection(852)) - Socket connection established to 192.168.3.67/192.168.3.67:2181, initiating session
2016-02-03 09:35:09,289 INFO zookeeper.ClientCnxn (ClientCnxn.java:onConnected(1235)) - Session establishment complete on server 192.168.3.67/192.168.3.67:2181, sessionid = 0x152a0c002ff0013, negotiated timeout = 90000[/mw_shl_code]
在Hbase服务器上看到已经建立的2181的端口连接,程序BUG追踪到table.exists时就停住了,一直在等待,请各位大神解惑
|
|