我的hbase版本是1.1.2
hbase java连接器是:
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.1.2</version>
</dependency>
我的hbase群集
1个主机:hadoop-153
4个hregionserver:hadoop-154、hadoop-146、hadoop-147、hadoop-148
3 zookeeper(嵌入hbase):hadoop-146、hadoop-147、hadoop-148
但当我使用代码时:
public class HBaseClientOld {
private static Configuration conf =null;
static {
conf = HBaseConfiguration.create();
}
/**
* @throws IOException
*/
public void createTable(String tablename, String[] cfs) throws IOException {
HBaseAdmin admin =new HBaseAdmin(conf);
System.out.println(conf.get("hbase.master"));
if (admin.tableExists(tablename)) {
System.out.println("The Table is existed");
}
else {
HTableDescriptor tableDesc =new HTableDescriptor(tablename);
for (int i =0; i < cfs.length; i++) {
tableDesc.addFamily(new HColumnDescriptor(cfs[i]));
}
admin.createTable(tableDesc);
System.out.println("create table successful");
}
}
public static void main(String[] args) throws IOException {
HBaseClientOld hbc = new HBaseClientOld();
hbc.createTable("res", new String[]{"data"});
}
}
但当我运行代码时,有一个例外:
Exception in thread "main" org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=36, exceptions:
Tue Dec 15 16:44:00 CST 2015, null, java.net.SocketTimeoutException: callTimeout=60000, callDuration=76198: row 'res,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=hadoop-154,16020,1450168253441, seqNum=0
...
Caused by: java.net.SocketTimeoutException: callTimeout=60000, callDuration=76198: row 'res,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=hadoop-154,16020,1450168253441, seqNum=0
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:159)
at org.apache.hadoop.hbase.client.ResultBoundedCompletionService$QueueingFuture.run(ResultBoundedCompletionService.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
有人帮忙吗。。
有zookeeper日志:
2015-12-15 17:53:47,821 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxnFactory: Accepted socket connection from /ip-client:50354
2015-12-15 17:53:47,824 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.ZooKeeperServer: Client attempting to establish new session at /ip-client:50354
2015-12-15 17:53:47,834 INFO [SyncThread:0] server.ZooKeeperServer: Established session 0x151a50e5a410010 with negotiated timeout 90000 for client /ip-client:50354
2015-12-15 17:53:57,638 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxnFactory: Accepted socket connection from /10.128.122.153:59426
2015-12-15 17:53:57,640 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.ZooKeeperServer: Client attempting to establish new session at /10.128.122.153:59426
2015-12-15 17:53:57,651 INFO [SyncThread:0] server.ZooKeeperServer: Established session 0x151a50e5a410011 with negotiated timeout 90000 for client /10.128.122.153:59426
2015-12-15 17:54:12,000 INFO [SessionTracker] server.ZooKeeperServer: Expiring session 0x51a4c3707f0005, timeout of 90000ms exceeded
2015-12-15 17:54:12,000 INFO [SessionTracker] server.ZooKeeperServer: Expiring session 0x51a4c3707f0003, timeout of 90000ms exceeded
2015-12-15 17:54:12,001 INFO [ProcessThread(sid:0 cport:-1):] server.PrepRequestProcessor: Processed session termination for sessionid: 0x51a4c3707f0005
2015-12-15 17:54:12,001 INFO [ProcessThread(sid:0 cport:-1):] server.PrepRequestProcessor: Processed session termination for sessionid: 0x51a4c3707f0003
2015-12-15 17:54:44,573 WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxn: Exception causing close of session 0x151a50e5a410010 due to java.io.IOException: Connection reset by peer
2015-12-15 17:54:44,574 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxn: Closed socket connection for client /ip-client:50354 which had sessionid 0x151a50e5a410010
2015-12-15 17:56:15,000 INFO [SessionTracker] server.ZooKeeperServer: Expiring session 0x151a50e5a410010, timeout of 90000ms exceeded
2015-12-15 17:56:15,000 INFO [ProcessThread(sid:0 cport:-1):] server.PrepRequestProcessor: Processed session termination for sessionid: 0x151a50e5a410010
暂无答案!
目前还没有任何答案,快来回答吧!