我有简单的HBase客户端程序在Windows 7 - 32位运行。客户端代码在这里给出:
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.client.HBaseAdmin;
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();
aConfig.set("hbase.zookeeper.quorum", "actual url");
aConfig.set("hbase.zookeeper.property.clientPort","actual port number");
HTable aTable = new HTable(aConfig, "TestTable");
byte[] aRowKey = Bytes.toBytes("RowKey1Mod");
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("");
}
}
}
HTable构造函数挂起,显示以下消息:
[main] INFO org.apache.zookeeper.ZooKeeper - Initiating client connection, connectString=zookeeper:2181 sessionTimeout=180000 watcher=hconnection
[main-SendThread(zookeeper:port)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server zookeeper/ip. Will not attempt to authenticate using SASL (Unable to locate a login configuration)
Oct 3, 2013 5:59:27 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper <init>
INFO: The identifier of this process is 1660@user-600b
[main-SendThread(zookeeper:port)] INFO org.apache.zookeeper.ClientCnxn - Socket connection established to zookeeper/ip:port, initiating session
[main-SendThread(zookeeper:port)] INFO org.apache.zookeeper.ClientCnxn - Session establishment complete on server zookeeper/ip:port, sessionid = 0x13f456cee1301f8, negotiated timeout = 40000
Oct 3, 2013 5:59:27 PM org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation internalClose
INFO: Closed zookeeper sessionid=0x13f456cee1301f8
[main] INFO org.apache.zookeeper.ZooKeeper - Session: 0x13f456cee1301f8 closed
[main-EventThread] INFO org.apache.zookeeper.ClientCnxn - EventThread shut down
[main] INFO org.apache.zookeeper.ZooKeeper - Initiating client connection, connectString=zookeeper sessionTimeout=180000 watcher=hconnection
Oct 3, 2013 5:59:27 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper <init>
INFO: The identifier of this process is 1660@user-600b
[main-SendThread(zookeeper:port)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server zookeeper/ip:port. Will not attempt to authenticate using SASL (Unable to locate a login configuration)
[main-SendThread(zookeeper:port)] INFO org.apache.zookeeper.ClientCnxn - Socket connection established to zookeeper/ip:port, initiating session
[main-SendThread(zookeeper:port)] INFO org.apache.zookeeper.ClientCnxn - Session establishment complete on server zookeeper/ip:port, sessionid = 0x13f456cee1301f9, negotiated timeout = 40000
请帮忙。这花了我很多时间。