JAVA api 远程hbase出错 org.apache.hadoop.hbase.client.RetriesExhaustedException

  1. 问题:JAVA api 远程hbase出错

    org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=36, exceptions:
    Tue Jul 19 16:36:05 CST 2016, null, java.net.SocketTimeoutException: callTimeout=60000, callDuration=79721: row ‘testtable,’ on table ‘hbase:meta’ at region=hbase:meta,1.1588230740, hostname=ubuntu,16020,1468916750524, seqNum=0

  2. 实验环境:
    windows10 idea下 Java API 远程hbase,其中hbase安装在虚拟环境下,采用NAT网络模式,hbase IP地址为192.168.137.25 。windows10 vmnet8 IP为192.168.137.1 双方都可以ping通,排除网络问题。

  3. 解决思路:
    首先 定位出错原因 :Caused by: java.net.UnknownHostException: ubuntu无法解析ubuntu主机名。
    此处的 ubuntu 为hbase所在虚拟机的主机名。解析不到ubuntu主机对应的IP地址,
    (1) 首先查看ubuntu主机下hosts信息
    gedit /etc/hosts

    127.0.0.1localhost
    127.0.1.1 ubuntu

The following lines are desirable for IPv6 capable hosts(此处为#注释,因为编辑器原因,改为手动文字注释)
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

(2)    java 连接代码如下:

     config = HBaseConfiguration.create();
	 config.set("hbase.zookeeper.quorum", "192.168.137.25");
	 config.set("hbase.zookeeper.property.clientPort", "2181");  
	 config.set("hbase.master", "192.168.137.25:9001"); 

```(3)  发现ubuntu对应的IP地址为127.0.1.1 ,添加192.168.137.25  ubuntu  并注释 127.0.1.1 ubuntu ```

127.0.0.1localhost(此处为#注释,因为编辑器原因,改为手动文字注释)
127.0.1.1  ubuntu(此处为#注释,因为编辑器原因,改为手动文字注释)

192.168.13725  ubuntu

```(4)  其中在windows10   下修改 C:\Windows\System32\drivers\etc\hosts,添加```

```192.168.137.25 ubuntu ```(本文楼主就差在了这一步)

**问题解决**

原因:hbase会根据192.168.137.25 找到虚拟机主机,并且根据主机hosts文件解析IP127.0.0.1,这就造成了无法识别主机名。
  1. 详细错误:
org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=36, exceptions:
Tue Jul 19 16:36:05 CST 2016, null, java.net.SocketTimeoutException: callTimeout=60000, callDuration=79721: row 'testtable,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=ubuntu,16020,1468916750524, seqNum=0
at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.throwEnrichedException(RpcRetryingCallerWithReadReplicas.java:276)
at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:207)
at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:60)
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:210)
at org.apache.hadoop.hbase.client.ClientScanner.call(ClientScanner.java:326)
at org.apache.hadoop.hbase.client.ClientScanner.nextScanner(ClientScanner.java:301)
at org.apache.hadoop.hbase.client.ClientScanner.initializeScannerInConstruction(ClientScanner.java:166)
at org.apache.hadoop.hbase.client.ClientScanner.<init>(ClientScanner.java:161)
at org.apache.hadoop.hbase.client.HTable.getScanner(HTable.java:797)
at org.apache.hadoop.hbase.MetaTableAccessor.fullScan(MetaTableAccessor.java:602)
at org.apache.hadoop.hbase.MetaTableAccessor.tableExists(MetaTableAccessor.java:366)
at org.apache.hadoop.hbase.client.HBaseAdmin.tableExists(HBaseAdmin.java:406)
at upc.hbase.utils.HbaseTable.createTable(HbaseTable.java:46)
at upc.hbase.test.HbaseTestDemo.main(HbaseTestDemo.java:20)
Caused by: java.net.SocketTimeoutException: callTimeout=60000, callDuration=79721: row 'testtable,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=ubuntu,16020,1468916750524, seqNum=0
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:169)
at org.apache.hadoop.hbase.client.ResultBoundedCompletionService$QueueingFuture.run(ResultBoundedCompletionService.java:65)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
```Caused by: java.net.UnknownHostException: ubuntu```
at org.apache.hadoop.hbase.ipc.AbstractRpcClient$BlockingRpcChannelImplementation.<init>(AbstractRpcClient.java:315)
at org.apache.hadoop.hbase.ipc.AbstractRpcClient.createBlockingRpcChannel(AbstractRpcClient.java:267)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getClient(ConnectionManager.java:1639)
at org.apache.hadoop.hbase.client.ScannerCallable.prepare(ScannerCallable.java:162)
at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas$RetryingRPC.prepare(ScannerCallableWithReplicas.java:372)
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:134)
... 4 more

本文转载自csdn文章:JAVA api 远程hbase出错 org.apache.hadoop.hbase.client.RetriesExhaustedException

23/07/23 16:19:48 ERROR AsyncProcess: Failed to get region location org.apache.hadoop.hbase.DoNotRetryIOException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.hbase.util.ByteStringer at org.apache.hadoop.hbase.client.RpcRetryingCaller.translateException(RpcRetryingCaller.java:241) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:214) at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas$RetryingRPC.call(ScannerCallableWithReplicas.java:364) at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas$RetryingRPC.call(ScannerCallableWithReplicas.java:338) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:137) at org.apache.hadoop.hbase.client.ResultBoundedCompletionService$QueueingFuture.run(ResultBoundedCompletionService.java:65) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.hbase.util.ByteStringer at org.apache.hadoop.hbase.protobuf.RequestConverter.buildRegionSpecifier(RequestConverter.java:1041) at org.apache.hadoop.hbase.protobuf.RequestConverter.buildScanRequest(RequestConverter.java:492) at org.apache.hadoop.hbase.client.ClientSmallReversedScanner$SmallReversedScannerCallable.call(ClientSmallReversedScanner.java:291) at org.apache.hadoop.hbase.client.ClientSmallReversedScanner$SmallReversedScannerCallable.call(ClientSmallReversedScanner.java:276) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:212) ... 7 more
07-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值