Hbase使用javaAPI链接调用和过滤器API的使用

HBase集群搭建和操作 文章目录6、HBase的集群环境搭建7、HBase常用shell操作1、进入HBase客户端命令操作界面2、查看帮助命令3、查看当前数据库中有哪些表4、创建一张表5、添加数据操作6、查询数据操作1、通过rowkey进行查询2、查看rowkey下面的某个列族的信息3、查看rowkey指定列族指定字段的值4、查看rowkey指定多个列族的信息4、指定rowkey与列值查询5、指定rowkey与列值模糊... 阅读详情

javaAPI调用链接Hbase

javaAPI链接Hbase的基础demo,后面的过滤部分也以此table为主

pom

		<!--HBASE START-->
		<dependency>
			<groupId>org.apache.hbase</groupId>
			<artifactId>hbase-client</artifactId>
			<version>1.4.9</version>
		</dependency>
		<dependency>
			<groupId>org.apache.hbase</groupId>
			<artifactId>hbase-server</artifactId>
			<version>1.4.9</version>
		</dependency>
		<dependency>
		<groupId>org.apache.hbase</groupId>
		<artifactId>hbase-common</artifactId>
		<version>1.4.9</version>
		</dependency>

		<!--HBASE END-->

java

public class HbaseDemo {


    private static Admin admin;

    public static void main(String[] args){
        System.setProperty("hadoop.home.dir", "d:/");

        String tableName ="user_table";
        try {
            createTable(tableName, new String[] { "information", "contact" });
            showTable(tableName);
            User user = new User("001", "xiaoming", "123456", "man", "20", "13355550021", "1232821@bmaoo.com");
            insertData("user_table", user);
            User user2 = new User("002", "xiaohong", "654321", "female", "18", "18757912212", "214214@bmaoo.com");
            insertData(tableName, user2);

            System.out.println("--------------------获取原始数据-----------------------");
            getNoDealData(tableName);
            System.out.println("--------------------行列簇值对应关系数据-----------------------");
            getAllRows(tableName);
            List<User> list = getAllData(tableName);
            System.out.println("--------------------原始数据解析处理后--------------------");
            for (User user3 : list){
                System.out.println(user3.toString());
            }

            System.out.println("--------------------根据rowKey查询--------------------");
            User user4 = getDataByRowKey("user_table", "user-001");
            System.out.println(user4.toString());
            System.out.println("--------------------获取指定列族:列的属性值数据-------------------");
            String user_phone = getCellData("user_table", "user-001", "contact", "phone");
            System.out.println(user_phone);
            System.out.println("--------------------插入测试数据--------------------");
//            User user5 = new User("test-003", "xiaoguang", "789012", "man", "22", "12312132214", "856832@bmaoo.com");
//            insertData("user_table", user5);
//            List<User> list2 = getAllData("user_table");
//
//            for (User user6 : list2){
//                System.out.println(user6.toString());
//            }

//            System.out.println("--------------------删除测试数据--------------------");
//            deleteByRowKey("user_table", "user-test-003");
//            List<User> list3 = getAllData("user_table");
//
//            for (User user7 : list3){
//                System.out.println(user7.toString());
//            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //连接集群
    public static Connection initHbase() throws IOException {

        Configuration configuration = HBaseConfiguration.create();
        configuration.set("hbase.zookeeper.quorum", "192.168.1.101");
        configuration.set("hbase.zookeeper.property.clientPort", "2181");

        //集群配置↓
        //configuration.set("hbase.zookeeper.quorum", "101.236.39.141,101.236.46.114,101.236.46.113");
//        configuration.set("hbase.master", "192.168.1.101:60000");
        Connection connection = ConnectionFactory.createConnection(configuration);
        return connection;
    }


    public static void scanDataStep1(String tableName) throws Exception {

        Table table= initHbase().getTable(TableName.valueOf(tableName));
        Scan scan = new Scan();
        ResultScanner scanner = table.getScanner(scan);
        for (Result result : scanner) {
            if (result.getValue(Bytes.toBytes("info"), Bytes.toBytes("f_pid")) == null) {
                for (KeyValue kv : result.raw()) {
                    System.out.print(new String(kv.getRow()) + " ");
                    System.out.print(new String(kv.getFamily()) + ":");
                    System.out.print(new String(kv.getQualifier()) + " = ");
                    System.out.print(new String(kv.getValue()));
                    System.out.print(" timestamp = " + kv.getTimestamp() + "\n");
                }
            }
        }
    }

    //创建表
    public static void createTable(String tableNmae, String[] cols) throws IOException {

        TableName tableName = TableName.valueOf(tableNmae);
        admin = initHbase().getAdmin();
        if (admin.tableExists(tableName)) {
            System.out.println("表已存在!");
        } else {
            HTableDescriptor hTableDescriptor = new HTableDescriptor(tableName);
            for (String col : cols) {
                HColumnDescriptor hColumnDescriptor = new HColumnDescriptor(col);
                hTableDescriptor.addFamily(hColumnDescriptor);
            }
            admin.createTable(hTableDescriptor);
        }
    }


    // 显示表结构
    public static void showTable(String tableNmae) throws Exception {
        admin = initHbase().getAdmin();
        HTableDescriptor tableDescriptor = admin.getTableDescriptor(TableName.valueOf(tableNmae));
        System.out.println("表结构--------------------------");
        byte[] name = tableDescriptor.getName();
        System.out.println("下面开始输出结果:");
        System.out.println("表名:" + new String(name));
        HColumnDescriptor[] columnFamilies = tableDescriptor.getColumnFamilies();
        for (HColumnDescriptor d : columnFamilies)
        {
            System.out.println("列族名:" + d.getNameAsString());
        }

    }

    //插入数据
    public static void insertData(String tableName, User user) throws IOException {
        TableName tablename = TableName.valueOf(tableName);
        Put put = new Put(("user-" + user.getId()).getBytes());
        //参数:1.列族名  2.列名  3.值
        put.addColumn("information".getBytes(), "username".getBytes(), user.getUsername().getBytes()) ;
        put.addColumn("information".getBytes(), "age".getBytes(), user.getAge().getBytes()) ;
        put.addColumn("information".getBytes(), "gender".getBytes(), user.getGender().getBytes()) ;
        put.addColumn("contact".getBytes(), "phone".getBytes(), user.getPhone().getBytes());
        put.addColumn("contact".getBytes(), "email".getBytes(), user.getEmail().getBytes());
        //HTable table = new HTable(initHbase().getConfiguration(),tablename);已弃用
        Table table = initHbase().getTable(tablename);
        table.put(put);
    }

    //获取原始数据
    public static void getNoDealData(String tableName){
        try {
            Table table= initHbase().getTable(TableName.valueOf(tableName));
            Scan scan = new Scan();
            ResultScanner resutScanner = table.getScanner(scan);
            for(Result result: resutScanner){
                System.out.println("scan:  " + result);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    // 得到所有数据,行,列簇,列名,值
    public static void getAllRows(String tableName) throws IOException{

        Table table = initHbase().getTable(TableName.valueOf(tableName));
        //得到用于扫描 region 的对象
        Scan scan = new Scan();
        //使用 HTable 得到 resultcanner 实现类的对象
        ResultScanner resultScanner = table.getScanner(scan);
        System.out.print("行键\t\t列族\t列\t值\n");
        for(Result result : resultScanner){
            Cell[] cells = result.rawCells();
            for(Cell cell : cells){
                //得到 rowkey
                System.out.print(Bytes.toString(CellUtil.cloneRow(cell)) +"\t");
                //得到列族
                System.out.print( Bytes.toString(CellUtil.cloneFamily(cell)) +"\t");
                System.out.print( Bytes.toString(CellUtil.cloneQualifier(cell))+"\t");
                System.out.println( Bytes.toString(CellUtil.cloneValue(cell)));
            }
            System.out.println("--------------------------------");
        }
    }

    //根据rowKey进行查询
    public static User getDataByRowKey(String tableName, String rowKey) throws IOException {

        Table table = initHbase().getTable(TableName.valueOf(tableName));
        Get get = new Get(rowKey.getBytes());
        User user = new User();
        user.setId(rowKey);
        //先判断是否有此条数据
        if(!get.isCheckExistenceOnly()){
            Result result = table.get(get);
            for (Cell cell : result.rawCells()){
                String colName = Bytes.toString(cell.getQualifierArray(),cell.getQualifierOffset(),cell.getQualifierLength());
                String value = Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
                if(colName.equals("username")){
                    user.setUsername(value);
                }
                if(colName.equals("age")){
                    user.setAge(value);
                }
                if (colName.equals("gender")){
                    user.setGender(value);
                }
                if (colName.equals("phone")){
                    user.setPhone(value);
                }
                if (colName.equals("email")){
                    user.setEmail(value);
                }
            }
        }
        return user;
    }

    //查询指定单cell内容
    public static String getCellData(String tableName, String rowKey, String family, String col){

        try {
            Table table = initHbase().getTable(TableName.valueOf(tableName));
            String result = null;
            Get get = new Get(rowKey.getBytes());
            if(!get.isCheckExistenceOnly()){
                get.addColumn(Bytes.toBytes(family),Bytes.toBytes(col));
                Result res = table.get(get);
                byte[] resByte = res.getValue(Bytes.toBytes(family), Bytes.toBytes(col));
                return result = Bytes.toString(resByte);
            }else{
                return result = "查询结果不存在";
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "出现异常";
    }

    //查询指定表名中所有的数据
    public static List<User> getAllData(String tableName){

        Table table = null;
        List<User> list = new ArrayList<User>();
        try {
            table = initHbase().getTable(TableName.valueOf(tableName));
            ResultScanner results = table.getScanner(new Scan());
            User user = null;
            for (Result result : results){
                String id = new String(result.getRow());
                System.out.println("用户名:" + new String(result.getRow()));
                user = new User();
                for(Cell cell : result.rawCells()){
                    String row = Bytes.toString(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
                    //String family =  Bytes.toString(cell.getFamilyArray(),cell.getFamilyOffset(),cell.getFamilyLength());
                    String colName = Bytes.toString(cell.getQualifierArray(),cell.getQualifierOffset(),cell.getQualifierLength());
                    String value = Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
                    user.setId(row);
                    if(colName.equals("username")){
                        user.setUsername(value);
                    }
                    if(colName.equals("age")){
                        user.setAge(value);
                    }
                    if (colName.equals("gender")){
                        user.setGender(value);
                    }
                    if (colName.equals("phone")){
                        user.setPhone(value);
                    }
                    if (colName.equals("email")){
                        user.setEmail(value);
                    }
                }
                list.add(user);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return list;
    }

    //删除指定cell数据
    public static void deleteByRowKey(String tableName, String rowKey) throws IOException {

        Table table = initHbase().getTable(TableName.valueOf(tableName));
        Delete delete = new Delete(Bytes.toBytes(rowKey));
        //删除指定列
        //delete.addColumns(Bytes.toBytes("contact"), Bytes.toBytes("email"));
        table.delete(delete);
    }

    //删除表
    public static void deleteTable(String tableName){

        try {
            TableName tablename = TableName.valueOf(tableName);
            admin = initHbase().getAdmin();
            admin.disableTable(tablename);
            admin.deleteTable(tablename);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }




}

HBase 过滤器

基础API中的查询操作在面对大量数据的时候是非常苍白的,这里Hbase提供了高级的查询方法:Filter。Filter可以根据簇、列、版本等更多的条件来对数据进行过滤,基于Hbase本身提供的三维有序(主键有序、列有序、版本有序),这些Filter可以高效的完成查询过滤的任务。带有Filter条件的RPC查询请求会把Filter分发到各个RegionServer,是一个服务器端(Server-side)的过滤器,这样也可以降低网络传输的压力。

要完成一个过滤的操作,至少需要两个参数。一个是抽象的操作符,Hbase提供了枚举类型的变量来表示这些抽象的操作符:LESS/LESS_OR_EQUAL/EQUAL/NOT_EUQAL等;另外一个就是具体的比较器(Comparator),代表具体的比较逻辑,如果可以提高字节级的比较、字符串级的比较等。有了这两个参数,我们就可以清晰的定义筛选的条件,过滤数据。

抽象操作符(比较运算符)

LESS <

LESS_OR_EQUAL <=

EQUAL =

NOT_EQUAL <>

GREATER_OR_EQUAL >=

GREATER >

NO_OP 排除所有

比较器(指定比较机制)

BinaryComparator 按字节索引顺序比较指定字节数组,采用 Bytes.compareTo(byte[])

BinaryPrefixComparator 跟前面相同,只是比较左端的数据是否相同

NullComparator 判断给定的是否为空

BitComparator 按位比较

RegexStringComparator 提供一个正则的比较器,仅支持 EQUAL 和非 EQUAL

SubstringComparator 判断提供的子串是否出现在 value 中

java编码


输出结果

user-006/contact:email/1546667518090/Put/vlen=16/seqid=0
user-006/contact:phone/1546667518090/Put/vlen=11/seqid=0
user-006/information:age/1546667518090/Put/vlen=2/seqid=0
user-006/information:gender/1546667518090/Put/vlen=3/seqid=0
user-006/information:password/1546667518090/Put/vlen=6/seqid=0
user-006/information:username/1546667518090/Put/vlen=7/seqid=0
user-007/contact:email/1546667518117/Put/vlen=16/seqid=0
user-007/contact:phone/1546667518117/Put/vlen=11/seqid=0
user-007/information:age/1546667518117/Put/vlen=2/seqid=0
user-007/information:gender/1546667518117/Put/vlen=6/seqid=0
user-007/information:password/1546667518117/Put/vlen=6/seqid=0
user-007/information:username/1546667518117/Put/vlen=7/seqid=0
user-008/contact:email/1546667518144/Put/vlen=16/seqid=0
user-008/contact:phone/1546667518144/Put/vlen=11/seqid=0
user-008/information:age/1546667518144/Put/vlen=2/seqid=0
user-008/information:gender/1546667518144/Put/vlen=3/seqid=0
user-008/information:password/1546667518144/Put/vlen=6/seqid=0
user-008/information:username/1546667518144/Put/vlen=7/seqid=0
user-009/contact:email/1546667518173/Put/vlen=16/seqid=0
user-009/contact:phone/1546667518173/Put/vlen=11/seqid=0
user-009/information:age/1546667518173/Put/vlen=2/seqid=0
user-009/information:gender/1546667518173/Put/vlen=6/seqid=0
user-009/information:password/1546667518173/Put/vlen=6/seqid=0
user-009/information:username/1546667518173/Put/vlen=7/seqid=0
列簇过滤器 FamilyFilter :过滤info信息----------------------------------------------------------------------
user-000/contact:email/1546667517904/Put/vlen=16/seqid=0
user-000/contact:phone/1546667517904/Put/vlen=11/seqid=0
user-001/contact:email/1546667517960/Put/vlen=16/seqid=0
user-001/contact:phone/1546667517960/Put/vlen=11/seqid=0
user-002/contact:email/1546667517996/Put/vlen=16/seqid=0
user-002/contact:phone/1546667517996/Put/vlen=11/seqid=0
user-003/contact:email/1546667518018/Put/vlen=16/seqid=0
user-003/contact:phone/1546667518018/Put/vlen=11/seqid=0
user-004/contact:email/1546667518041/Put/vlen=16/seqid=0
user-004/contact:phone/1546667518041/Put/vlen=11/seqid=0
user-005/contact:email/1546667518067/Put/vlen=16/seqid=0
user-005/contact:phone/1546667518067/Put/vlen=11/seqid=0
user-006/contact:email/1546667518090/Put/vlen=16/seqid=0
user-006/contact:phone/1546667518090/Put/vlen=11/seqid=0
user-007/contact:email/1546667518117/Put/vlen=16/seqid=0
user-007/contact:phone/1546667518117/Put/vlen=11/seqid=0
user-008/contact:email/1546667518144/Put/vlen=16/seqid=0
user-008/contact:phone/1546667518144/Put/vlen=11/seqid=0
user-009/contact:email/1546667518173/Put/vlen=16/seqid=0
user-009/contact:phone/1546667518173/Put/vlen=11/seqid=0
值过滤器 ValueFilter :过滤性别为女的数据----------------------------------------------------------------------
user-001/information:gender/1546667517960/Put/vlen=6/seqid=0
user-003/information:gender/1546667518018/Put/vlen=6/seqid=0
user-005/information:gender/1546667518067/Put/vlen=6/seqid=0
user-007/information:gender/1546667518117/Put/vlen=6/seqid=0
user-009/information:gender/1546667518173/Put/vlen=6/seqid=0
时间戳过滤器 TimestampsFilter ValueFilter :过滤时间戳为1546665288963的数据----------------------------------------------------------------------
单列值过滤器 SingleColumnValueFilter :过滤名字为hbase_4的数据----------------------------------------------------------------------
user-004	contact	email	base_4@hbase.com	1546667518041
user-004	contact	phone	13355550024	1546667518041
user-004	information	age	20	1546667518041
user-004	information	gender	man	1546667518041
user-004	information	password	123456	1546667518041
user-004	information	username	hbase_4	1546667518041
前缀过滤器 PrefixFilter----只对行键有用----------------------------------------------------------------------
user-000	contact	email	base_0@hbase.com	1546667517904
user-000	contact	phone	13355550020	1546667517904
user-000	information	age	20	1546667517904
user-000	information	gender	man	1546667517904
user-000	information	password	123456	1546667517904
user-000	information	username	hbase_0	1546667517904
user-001	contact	email	base_1@bmaoo.com	1546667517960
user-001	contact	phone	13355550021	1546667517960
user-001	information	age	21	1546667517960
user-001	information	gender	female	1546667517960
user-001	information	password	123456	1546667517960
user-001	information	username	hbase_1	1546667517960
user-002	contact	email	base_2@hbase.com	1546667517996
user-002	contact	phone	13355550022	1546667517996
user-002	information	age	20	1546667517996
user-002	information	gender	man	1546667517996
user-002	information	password	123456	1546667517996
user-002	information	username	hbase_2	1546667517996
user-003	contact	email	base_3@bmaoo.com	1546667518018
user-003	contact	phone	13355550023	1546667518018
user-003	information	age	21	1546667518018
user-003	information	gender	female	1546667518018
user-003	information	password	123456	1546667518018
user-003	information	username	hbase_3	1546667518018
user-004	contact	email	base_4@hbase.com	1546667518041
user-004	contact	phone	13355550024	1546667518041
user-004	information	age	20	1546667518041
user-004	information	gender	man	1546667518041
user-004	information	password	123456	1546667518041
user-004	information	username	hbase_4	1546667518041
user-005	contact	email	base_5@bmaoo.com	1546667518067
user-005	contact	phone	13355550025	1546667518067
user-005	information	age	21	1546667518067
user-005	information	gender	female	1546667518067
user-005	information	password	123456	1546667518067
user-005	information	username	hbase_5	1546667518067
user-006	contact	email	base_6@hbase.com	1546667518090
user-006	contact	phone	13355550026	1546667518090
user-006	information	age	20	1546667518090
user-006	information	gender	man	1546667518090
user-006	information	password	123456	1546667518090
user-006	information	username	hbase_6	1546667518090
user-007	contact	email	base_7@bmaoo.com	1546667518117
user-007	contact	phone	13355550027	1546667518117
user-007	information	age	21	1546667518117
user-007	information	gender	female	1546667518117
user-007	information	password	123456	1546667518117
user-007	information	username	hbase_7	1546667518117
user-008	contact	email	base_8@hbase.com	1546667518144
user-008	contact	phone	13355550028	1546667518144
user-008	information	age	20	1546667518144
user-008	information	gender	man	1546667518144
user-008	information	password	123456	1546667518144
user-008	information	username	hbase_8	1546667518144
user-009	contact	email	base_9@bmaoo.com	1546667518173
user-009	contact	phone	13355550029	1546667518173
user-009	information	age	21	1546667518173
user-009	information	gender	female	1546667518173
user-009	information	password	123456	1546667518173
user-009	information	username	hbase_9	1546667518173
列前缀过滤器 ColumnPrefixFilter匹配password,phone两个----------------------------------------------------------------------
user-000	contact	phone	13355550020	1546667517904
user-000	information	password	123456	1546667517904
user-001	contact	phone	13355550021	1546667517960
user-001	information	password	123456	1546667517960
user-002	contact	phone	13355550022	1546667517996
user-002	information	password	123456	1546667517996
user-003	contact	phone	13355550023	1546667518018
user-003	information	password	123456	1546667518018
user-004	contact	phone	13355550024	1546667518041
user-004	information	password	123456	1546667518041
user-005	contact	phone	13355550025	1546667518067
user-005	information	password	123456	1546667518067
user-006	contact	phone	13355550026	1546667518090
user-006	information	password	123456	1546667518090
user-007	contact	phone	13355550027	1546667518117
user-007	information	password	123456	1546667518117
user-008	contact	phone	13355550028	1546667518144
user-008	information	password	123456	1546667518144
user-009	contact	phone	13355550029	1546667518173
user-009	information	password	123456	1546667518173

更多hadoop进阶源码请参看我的github地址

springboot-habse操作整合
https://gitee.com/susonglin/springboot_hbase_kafka

HBase安装配置以及Java操作hbase Apache HBase Apache HBase™是Hadoop数据库,是一个分布式,可扩展的大数据存储。 当您需要对大数据进行随机,实时读/写访问时,请使用Apache HBase™。该项目的目标是托管非常大的表 - 数十亿行X百万列 - 在商品硬件集群上。Apache HBase是一个开源的,分布式的,版本化的非关系数据库 特征 线性和模块化可扩展性。 严格一致的读写操作。 ... 阅读详情

相关推荐

Hbase系列-2、Hbase基础

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 大数据系列文章目录 Hbase的官网 目录Hbase的基本简介Hbase的基本介绍Hbase的应用场景Hbase的发展历程Hbase的特点Hbase与RDBMS、HDFS 、Hive的区别Hbase的表模型Hbase的相关操作-命令式Hbase的基础操作命令Hbase高级shell管理命令 Hbase的基本简介 Hbase的基本介绍 NoSQL是一个通用术语,泛指一个数据库并不是使用SQL作为主要语言

不积跬步无以至千里,不积小流无以成江河 1727

java使用hbase过滤器

1.什么是过滤器 过滤器可以根据列族、列、版本等更多的条件来对数据进行过滤, 基于 HBase 本身提供的三维有序(行键,列,版本有序),这些过滤器可以高效地完成查询过滤的任务,带有过滤器条件的 RPC 查询请求会把过滤器分发到各个 RegionServer(这是一个服务端过滤器),这样也可以降低网络传输的压力。 2.比较运算符 LESS < LESS_OR_EQUAL <= EQUAL = NOT_EQUAL <> GREAT

zzds111的博客 3752

java操作Hbase之Hbase专用过滤器PageFilter的使用源代码

java操作Hbase之Hbase专用过滤器PageFilter的使用源代码,附带全部所需源代码,欢迎下载学习。

Java连接HBase

Java连接HBase的方法,包含Kerberos认证。 代码示例: package com.example.hbase.admin; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hba

邢为栋 8892

Unity游戏开发客户端面经——数据结构(初级)

Unity游戏开发客户端面经 之 数据结构篇

Sea3752的博客 1万+

从零搭建芯片设计环境:在Cadence虚拟机中集成QRC进行寄生参数提取

本文详细介绍了在Cadence虚拟机中集成QRC工具进行芯片设计中的寄生参数提取的全流程。从环境准备、QRC安装配置到实际提取操作,提供了完整的步骤指南和常见问题解决方案,帮助工程师高效搭建芯片设计环境并优化提取性能。

weixin_30379531的博客 618

Java大数据学习15--Hbase的JavaAPI使用(查询条件过滤器)

Hbase中的过滤器相当于sql中的查询条件,通过各种过滤器我们可以实现多样化的查询功能。下面我们来介绍一下这些过滤器。 一、过滤器的种类: 1、列植过滤器—SingleColumnValueFilter 过滤列植的相等、不等、范围等 2、列名前缀过滤器—ColumnPrefixFilter 过滤指定前缀的列名 3、多个列名前缀过滤器—MultipleColumnPref...

stalin_的博客 2154

iPhone用户必看:TrollStore巨魔商店在线安装保姆级教程(iOS 14-16.6.1适用)

本文为iOS 14至16.6.1系统的iPhone用户提供了一份详细的TrollStore(巨魔商店)在线安装教程。文章从核心原理、安装前准备讲起,逐步详解了通过Safari浏览器获取安装器、信任企业证书、部署TrollStore及关键后置配置的全过程,并附带了常见问题排错指南,帮助用户安全、高效地实现无需越狱安装第三方应用。

h0i1j2k3l的博客 1972

hbase shell及 java api的过滤器操作

一. hbase shell的filter操作 1. 不设置过滤器,全表扫描 scan '表名' //查询出某个表格内全部的数据记录 举例 : scan 'upos_city_qh_yushu:tb_detail_userloc_outdoor_22180822' 查询结果如下(截取了其中一个行键的内容) : 因为hbase的shell脚本操作十分不方便,并且不支持查看上下文,对我们使用者...

.... 2625

【速通版!语义通信基础与前沿学习计划】

🧠语义通信基础与前沿学习计划

dally2的博客 1412

打通Creo与Matlab的桥梁:Simscape Multibody Link插件安装与配置全攻略

本文详细介绍了Simscape Multibody Link插件的安装与配置全流程,旨在帮助机械工程师和开发者打通Creo与Matlab/Simulink之间的桥梁,实现CAD模型到多体动力学仿真的高效转换。文章重点解析了版本兼容性、管理员权限、注册文件配置等关键步骤与常见故障排查方法,助力用户快速建立设计与仿真一体化工作流。

rrr55的博客 634

hbase java操作api - 过滤器Filter使用

过滤器(Filter)   基础API中的查询操作在面对大量数据的时候是非常苍白的,这里Hbase提供了高级的查询方法:Filter。Filter可以根据簇、列、版本等更多的条件来对数据进行过滤,基于Hbase本身提供的三维有序(主键有序、列有序、版本有序),这些Filter可以高效的完成查询过滤的任务。带有Filter条件的RPC查询请求会把Filter分发到各个RegionServer,是一个服务器端(Server-side)的过滤器,这样也可以降低网络传输的压力。   要完成一个过滤的操作,至少需

小哇 3198

Multisim14.0仿真应用设计(十六)74LS138译码器应用仿真

74LS138为3线-8线译码器。

zhusl6688的博客 2979

hbase的javaapi操作之过滤器fillter

hbase的javaapi操作之过滤器fillter 过滤器:相当于where语句 因为列值过滤器都属于表的操作,属于DML语句,所以我们使用链接来获取表,再用表进行操作 而这个过滤器最终是塞到了SCAN对象中进行操作的,相当于select * from emp where 测试数据:员工表 ()列值过滤器 列值过滤器就是某一列的是多少的行 ()列名前缀过滤器 ()多个列名前缀过滤器 ()rowk...

枣泥馅的博客 895

YOLOv11 改进 - C2PSA | C2PSA融合TSSA(Token Statistics Self-Attention)令牌统计自注意力,优化遮挡目标感知

本文介绍了Token Statistics Self-Attention(TSSA)机制,并将其集成到YOLOv11中。传统自注意力计算复杂度高,TSSA进行了范式转变,基于token统计特征实现高效注意力交互。它通过“算法展开”推导得出,以“最大编码率降低”为目标,实现特征学习。TSSA包含动态分组和低秩投影优化两步创新,具备线性复杂度。我们将TSSA代码集成到YOLOv11的C2PSA模块中。实验表明,改进后的YOLOv11在目标检测任务中表现良好,验证了TSSA机制的有效性。

魔改工程师的博客 668

RT-DETR 模型剪枝优化:结构化剪枝对 R18/R50 性能的影响

本文提出分层结构化剪枝策略R18:参数量减少 42%(28M→16.2M),推理速度提升 35%(15→20.3 FPS@Jetson Nano),mAP@0.5 仅降 1.2%;R50:参数量减少 55%(170M→76.5M),推理速度提升 48%(42→62.2 FPS@T4),mAP@0.5 仅降 2.1%。核心价值:为 RT-DETR 提供“精度-效率-部署”平衡的轻量化方案,推动其在边缘设备、工业质检等场景的大规模落地。部署建议。

走向CTO的路上... 464

javaapi 访问 hbase

Hbase介绍 HBASE是一个高可靠性、高性能、面向列、可伸缩的分布式存储系统,利用HBASE技术可在廉价PC Server上搭建起大规模结构化存储集群。 HBASE的目标是存储并处理大型的数据,更具体来说是仅需使用普通的硬件配置,就能够处理由成千上万的行和列所组成的大型数据。 HBASE是Google Bigtable的开源实现,但是也有很多不同之处。比如:Google Bigtable利用G...

zhangMY12138的博客 400

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

Hbase Java API 代码开发(CURD,Filter 过滤器)

Hbase Java API 代码开发1、Hbase API 类和数据模型1.1、HBaseAdmin1.2、HBaseConfiguration1.3、HTableDescriptor1.4、HColumnDescriptor1.5、HTable 1、Hbase API 类和数据模型 几个主要 Hbase API 类和数据模型之间的对应关系: java 类 HBase 数据模型 HBaseAdmin 数据库(DataBase) HBaseConfiguration 数据库(DataBa

weixin_44387652的博客 777

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

hbase java api 连接_JavaAPI与hbase的交互

1 packagecom.hblink.test;23 importjava.io.IOException;4 importjava.util.Scanner;56 importorg.apache.hadoop.conf.Configuration;7 importorg.apache.hadoop.hbase.client.HTable;8 importorg.apache.hadoop.hb...

weixin_32233079的博客 174

HBase的简单学习二

HBase的进阶建表以及API操作

weixin_65909965的博客 1586

java hbase zookeeper_IDEA Zookeeper 配置 和HBase 配置 (附JavaAPI)

packagecom.hadoop.hbase;importjava.io.IOException;importjava.util.ArrayList;importjava.util.Iterator;importorg.apache.hadoop.conf.Configuration;importorg.apache.hadoop.hbase.Cell;importorg.apache.hado...

weixin_39726379的博客 243

Hbase JavaApi

Hbase JavaApi package cn.itcast.hbase; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import ...

这里将承载一段最初的记忆 237

Java API 连接Hbase数据库并进行操作

Java API 对Hbase数据库进行一系列操作 package z_hbase; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDe

Powehi777的博客 394

hbase

入门HBase 概览 特性 Hbase是一种NoSQL数据库,这意味着它不像传统的RDBMS数据库那样支持SQL作为查询语言。Hbase是一种分布式存储的数据库,技术上来讲,它更像是分布式存储而不是分布式数据库,它缺少很多RDBMS系统的特性,比如列类型,辅助索引,触发器,和高级查询语言等待。 那Hbase有什么特性呢?如下: 强读写一致,但是不是“最终一致性”的数据存储,这使得它非常适合高速的计算聚合 自动分片,通过Region分散在集群中,当行数增长的时候,Region也会自动的切分和再分配 自动的故

iMark 294
上一篇: Hbase单机安装和javaAPI客户端链接测试
下一篇: Phoenix使用指南
牧竹子
博客等级 码龄17年 572粉丝 233原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值