• HBase之show table


    import org.apache.hadoop.hbase.HTableDescriptor;
    import org.apache.hadoop.hbase.TableName;
    import org.apache.hadoop.hbase.client.Admin;
    import org.apache.hadoop.hbase.client.Connection;
    import org.apache.hadoop.hbase.client.ConnectionFactory;
    
    import java.io.IOException;
    import java.util.regex.Pattern;
    
    /**
     * Created by similarface on 16/8/30.
     */
    public class ShowTableInHbase {
        public static void main(String args[]) throws IOException{
            Connection connection = ConnectionFactory.createConnection();
            Admin admin = connection.getAdmin();
            HTableDescriptor[] htds = admin.listTables();
            for (HTableDescriptor htd:htds){
                System.out.println(htd);
            }
            HTableDescriptor htd1 = admin.getTableDescriptor(TableName.valueOf("user"));
            System.out.println(htd1);
    
            HTableDescriptor htd2 = admin.getTableDescriptor(TableName.valueOf("user"));
            System.out.println(htd2);
    
            HTableDescriptor[] htdsall = admin.listTables(".*");
            htds = admin.listTables(".*", true);
            htds = admin.listTables("hbase:.*", true);
            htds = admin.listTables("def.*:.*", true);
            htds = admin.listTables("test.*");
            Pattern pattern = Pattern.compile(".*2");
            htds = admin.listTables(pattern);
            htds = admin.listTableDescriptorsByNamespace("testspace1");
    
        }
    }
    
    /**
     'testtable2', {NAME => 'colfam1', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}
     'user', {NAME => 'info', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'ship', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}
     'user', {NAME => 'info', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'ship', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}
     'user', {NAME => 'info', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'ship', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}
     **/
  • 相关阅读:
    推荐:俞敏洪的一分钟励志演讲
    信息系统开发平台OpenExpressApp - 内置支持的列表编辑方式
    WPF - 资源收集
    开源 - 开源协议
    信息系统开发平台OpenExpressApp - 总体架构的由来
    WPF - DataGrid 相关收集
    报表引擎 -架构描述
    推荐:图标编辑器
    Scrum之 回顾会议
    从买房来看软件有哪几个主要关注点
  • 原文地址:https://www.cnblogs.com/similarface/p/5821910.html
Copyright © 2020-2023  润新知