zoukankan      html  css  js  c++  java
  • 13 hbase连接

     Configuration conf=new Configuration();
            String zookeeper="";
            String clientport="2181";
            String tableName="pbtest";
            String rowkey="22977609";
            conf.set(HBASE_ZOOKEEPER_QUORUM, zookeeper);
            conf.set(HBASE_ZOOKEEPER_CLINETPORT, clientport);
            conf= HBaseConfiguration.create(conf);
    
            Table table=null;
            try {
                Connection connection = ConnectionFactory.createConnection(conf);
                table=connection.getTable(TableName.valueOf(tableName));
            } catch (IOException e) {
                e.printStackTrace();
            }
            Get get=new Get(Bytes.toBytes(rowkey));
            Result result= null;
            try {
                result = table.get(get);
            } catch (IOException e) {
                e.printStackTrace();
            }
            Cell cell = result.getColumnLatestCell(Bytes.toBytes("cf"), Bytes.toBytes("data"));
            byte[] value = CellUtil.cloneValue(cell);
  • 相关阅读:
    设计模式
    设计模式
    设计模式
    JS | Reduce
    JS | 数组的深拷贝与浅拷贝
    JS | 数组操作
    Lodash | 指定路径对Object操作
    Git | 场景总结
    ES6 Class
    SpringBoot | Jpa @Id @GeneratedValue
  • 原文地址:https://www.cnblogs.com/yangh2016/p/6121769.html
Copyright © 2011-2022 走看看