hbase java client无法连接 hbase server


使用如下java代码连接hbae,然后输出hbase其中一个表的记录(输出的代码就不贴出来了):

        Configuration HBASE_CONFIG = new Configuration();      
        HBASE_CONFIG.set("hbase.zookeeper.quorum", "192.168.2.1"); 
//        HBASE_CONFIG.set("hbase.zookeeper.property.clientPort", "2181"); 
        Configuration configuration = HBaseConfiguration.create(HBASE_CONFIG);
	    try {
	      table = new HTable(configuration,"shorturl");
	    } catch (IOException e) {
	      e.printStackTrace();
	    }



运行,打印以下信息后,等待了很久都没有任何错误信息出现(晚上加班搞,不关机回家,第二天一看还是没有日志输出):

log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/develop/repo/ch/qos/logback/logback-classic/1.0.6/logback-classic-1.0.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/develop/repo/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.selector.DefaultContextSelector]



解决方法:

把机器192.168.2.1的域名添加到文件 /ect/hosts 中:

192.168.2.1 test-192-168-2-1



具体原理参照http://stackoverflow.com论坛里的回复:点击打开链接









  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值