HBaseJAVAAPI怎么用
                                            这篇文章主要介绍HBase JAVA API怎么用,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

成都创新互联主要从事做网站、网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务中方,10余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108
Maven
pom.xml
org.apache.hbase hbase-client 1.3.5 org.apache.hbase hbase-server 1.3.5 
静态代码块
private static Connection connection = null;    private static Admin admin = null;;    static {        try {            Configuration configuration = HBaseConfiguration.create();            configuration.set("hbase.zookeeper.quorum", "aliyun:2181");            connection = ConnectionFactory.createConnection(configuration);            admin = connection.getAdmin();        } catch (IOException e) {            e.printStackTrace();        }    }创建表
    //创建表    public static void createTable(String tableName, String[] cols) throws IOException {        TableName table = TableName.valueOf(tableName);        if (admin.tableExists(table)) {            System.out.println("表已存在!");        } else {            HTableDescriptor hTableDescriptor = new HTableDescriptor(tableName);            for (String col : cols) {                HColumnDescriptor hColumnDescriptor = new HColumnDescriptor(col);                hTableDescriptor.addFamily(hColumnDescriptor);            }            try {                admin.createTable(hTableDescriptor);            } catch (IOException e) {                e.printStackTrace();            }        }    }以上是“HBase JAVA API怎么用”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!
网站栏目:HBaseJAVAAPI怎么用
标题URL:http://www.cqwzjz.cn/article/ggcjep.html

 建站
建站
 咨询
咨询 售后
售后
 建站咨询
建站咨询 
 