HBase的Java Api连接失败的问题及解决方法

分布式方式部署的HBase,启动正常,Shell操作正常,使用HBase的Java Api操作时总是连接失败,信息如下:

This server is in the failed servers list: localhost.localdomain/202.102.110.204:60000
 
HBase部署在192.168.100.28,IP地址变掉了原因在于DNS解析,
临时解决办法,可以在调用Api的客户端机器上的hosts文件中加上一条记录
192.168.100.28  localhost.localdomain
localhost.localdomain指向部署HBase的机器。
 
运行结果正常,如下:
14/01/07 13:42:13 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost.localdomain/192.168.100.28:2181, sessionid = 0x1436ac6e838002f, negotiated timeout = 180000
14/01/07 13:42:14 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=192.168.100.28:2181 sessionTimeout=180000 watcher=catalogtracker-on-org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@9df6f1
14/01/07 13:42:14 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost.localdomain/192.168.100.28:2181. Will not attempt to authenticate using SASL (无法定位登录配置)
14/01/07 13:42:14 INFO zookeeper.ClientCnxn: Socket connection established to localhost.localdomain/192.168.100.28:2181, initiating session
14/01/07 13:42:14 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost.localdomain/192.168.100.28:2181, sessionid = 0x1436ac6e8380030, negotiated timeout = 180000
2014-1-7 13:42:14 org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper <init>
信息: The identifier of this process is 664@zhaozh
table already exists!
14/01/07 13:42:14 INFO zookeeper.ZooKeeper: Session: 0x1436ac6e8380030 closed
14/01/07 13:42:14 INFO zookeeper.ClientCnxn: EventThread shut down
insert recored zkb to table scores ok.
insert recored zkb to table scores ok.
insert recored zkb to table scores ok.
insert recored zkb to table scores ok.
insert recored zkb to table scores ok.
insert recored baoniu to table scores ok.
insert recored baoniu to table scores ok.
===========get one record========
family  ::  course
qualifier  ::  art
course: 
course:art 
1389073395709 
course:math 
grade: 
===========show all record========
baoniu course:math 1389073395719 89
baoniu grade: 1389073395714 4
zkb course: 1389073395672 90
zkb course:art 1389073395709 
posted @   russellwang  阅读(5464)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
点击右上角即可分享
微信分享提示