hbase 新人求助

sydra 2014-07-03 02:02:17
我自己搭建了一个伪分布的hbase,并且用hbase shell可以正常访问,但是我通过java客户端就是连接不上,并抛出下面的异常,让我看了一头雾水.
下面是异常信息
Exception in thread "main" java.lang.NumberFormatException: For input string: "52392???dW??PBUF

fedora???????(
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:458)
at java.lang.Integer.parseInt(Integer.java:499)
at org.apache.hadoop.hbase.HServerAddress.<init>(HServerAddress.java:63)
at org.apache.hadoop.hbase.MasterAddressTracker.getMasterAddress(MasterAddressTracker.java:63)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:353)
at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:89)
at org.sluggard.my.hbase.HBaseTest2.creatTable(HBaseTest2.java:46)
at org.sluggard.my.hbase.HBaseTest2.main(HBaseTest2.java:305)

再下面是我的连接代码,求高手帮我分析下,可能是什么原因

    import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.HTablePool;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.util.Bytes;

public class HBaseTest2 {

// 声明静态配置
static Configuration conf = null;
static final HTablePool tablePool;

static {
conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", "fedora");
conf.set("hbase.zookeeper.property.clientPort", "2181");
tablePool = new HTablePool(conf, 10);
}

public static void creatTable(String tableName, String[] family)
throws Exception {
HBaseAdmin admin = new HBaseAdmin(conf);
HTableDescriptor desc = new HTableDescriptor(tableName);
for (int i = 0; i < family.length; i++) {
desc.addFamily(new HColumnDescriptor(family[i]));
}
if (admin.tableExists(tableName)) {
System.out.println("table Exists!");
System.exit(0);
} else {
admin.createTable(desc);
System.out.println("create table Success!");
}
}

public static void main(String[] args) throws Exception {

// 创建表
String tableName = "blog2"; String[] family = { "article","author" };
creatTable(tableName,family);
}
}
...全文
1087 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangbiyun 2018-06-13
  • 打赏
  • 举报
回复
18/06/13 13:30:23 INFO zookeeper.ClientCnxn: Socket connection established to master/192.168.56.1:2181, initiating session 18/06/13 13:30:23 INFO zookeeper.ClientCnxn: Session establishment complete on server master/192.168.56.1:2181, sessionid = 0x163f795d7e1000e, negotiated timeout = 40000 java.lang.NumberFormatException: For input string: "16000Qj�p�P��PBUF " windows10.microdone.cn�}��׼�,
zhangbiyun 2018-06-13
  • 打赏
  • 举报
回复
楼主解决了吗?我也遇到同样的问题。 18/06/13 13:28:23 INFO zookeeper.ClientCnxn: Opening socket connection to server master/192.168.56.1:2181. Will not attempt to authenticate using SASL (unknown error) 18/06/13 13:28:23 INFO zookeeper.ClientCnxn: Socket connection established to master/192.168.56.1:2181, initiating session 18/06/13 13:28:23 INFO zookeeper.ClientCnxn: Session establishment complete on server master/192.168.56.1:2181, sessionid = 0x163f795d7e1000c, negotiated timeout = 40000 java.lang.NumberFormatException: For input string: "16000Qj�p�P��PBUF " windows10.microdone.cn�}��׼�,
晒不干的咸鱼 2016-03-23
  • 打赏
  • 举报
回复
楼主怎么解决的呀 ,我也遇到这个问题了,可以指导一下吗
shuideyashan 2016-02-04
  • 打赏
  • 举报
回复
shuideyashan 2016-02-04
  • 打赏
  • 举报
回复
请问,问题解决了吗?hosts也配了,防火墙也关了。相同的程序,其他人可以成功创建hbase表,我这边也是报这个错。
风中的小草 2015-08-05
  • 打赏
  • 举报
回复
请教一下,问题解决了吗,是什么原因呢
weitao1234 2014-07-19
  • 打赏
  • 举报
回复
ip映射的问题,服务器返回的字符串不能解析,在hosts里面增加映射
东风无眠 2014-07-11
  • 打赏
  • 举报
回复
zookeeper的ip配了吗 regionserver配了吗 客户端hosts改了吗
  • 打赏
  • 举报
回复
/** 与hbase/conf/hbase-site.xml中hbase.master配置的值相同 */ configuration.set("hbase.master", "192.168.10.10:60000"); /** 与hbase/conf/hbase-site.xml中hbase.zookeeper.quorum配置的值相同 */ configuration.set("hbase.zookeeper.quorum", "192.168.10.10"); /** 与hbase/conf/hbase-site.xml中hbase.zookeeper.property.clientPort配置的值相同 */ configuration.set("hbase.zookeeper.property.clientPort", "2181");
程序江湖_zpl 2014-07-08
  • 打赏
  • 举报
回复
(HBaseAdmin.java:89) 这行代码发出来看看 代码没有贴全把

20,808

社区成员

发帖
与我相关
我的任务
社区描述
Hadoop生态大数据交流社区,致力于有Hadoop,hive,Spark,Hbase,Flink,ClickHouse,Kafka,数据仓库,大数据集群运维技术分享和交流等。致力于收集优质的博客
社区管理员
  • 分布式计算/Hadoop社区
  • 涤生大数据
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧