hbase连接异常
创建连接的时候报此异常,客户端连接代码如下
public void createTable() {
Configuration config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", "172.16.192.60");
config.set("hbase.zookeeper.property.clientPort", "2181");
Connection connection = null;
Admin admin = null;
try {
//创建connection出现异常感觉感觉少包
connection = ConnectionFactory.createConnection(config);
admin = connection.getAdmin();
LOG.info("==============>>"+admin);
LOG.info("==============>>"+admin);
String tableName = "users";
if (!admin.isTableAvailable(TableName.valueOf(tableName))) {
HTableDescriptor hbaseTable = new HTableDescriptor(TableName.valueOf(tableName));
hbaseTable.addFamily(new HColumnDescriptor("name"));
hbaseTable.addFamily(new HColumnDescriptor("contact_info"));
hbaseTable.addFamily(new HColumnDescriptor("personal_info"));
admin.createTable(hbaseTable);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (admin != null) {
admin.close();
}
if (connection != null && !connection.isClosed()) {
connection.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
需要hadoop和hbase的相关jar包,建议全加上,再逐个排查