Hbse笔记

1 角色
    HMaster
    RegionServer
        Region:一张table
        Hbase为了读写高效 有二级缓存,内存的缓存和磁盘的缓存
        HLog:既有存储的业务数据,又有对业务数据的操作
2 HBase的特性
    列式存储:
    稀疏
    无模式
    数据多版本
    
3 Hbase安装部署问题
    时间同步
    配置文件 hbase.master
    hadoop集群和zookeeper集群确定驱动正常
    HA
    查看日志文件
4 Hbase shell  
    进入终端的命令:bin/hbase shell
    exit 或 quit 退出hbase shell
    Group name: general
        Commands:  table_help, version, whoami
        table_help:表引用相关的命令
        version : 查看hbase的版本
        whoami :查看用户信息
    Group name: ddl
    Commands: alter, alter_async, alter_status, create, describe, disable, disable_all, drop, drop_all, enable, enable_all, exists, get_table, is_disabled, is_enabled, list, locate_region, show_filters
        create 创建表
            create 'tablename','columnFamily','...'
        describe : 查看表的描述信息
            describe 'tablename'
        alter : 修改表
            alter 'student','cf2'
        alter_async :修改表,异步更新
        alter_status : 查看alter的状态
            alter_status 'tablename'
        disable : 指定表下线 ,不能做任何的操作
            disable 'tablename'
        drop 删除表 如果想删除某个表先下线表,然后再删除
        enable :指定表上线
        disable_all :
        exists :表是否存在
        get_table : 给已经存在的表加引用
         t = get_table 'tablename'
        is_disabled : 判断表是否下线
            如果是下线表就返回true 否则返回false
        is_enabled : 判断表是否上线
        list : 罗列表
        locate_region:指定表和rowkey,返回rowkey 所在的region的信息
            locate_region 'tablename','rowkey'
        show_filters : 查看hbase中的过滤器
    Group name: dml
    Commands: append, count, delete, deleteall, get, get_counter, get_splits, incr, put, scan, truncate, truncate_preserve
    
        put:向hbase表中插入数据
            put 'tablename','rowkey','columnFamily:column','value'
        scan : 扫描表
            scan 'tablename' (全表扫描)
            scan 'tablename',{COLUMNS => 'cf1:name'} (指定扫描某一列)
            scan 'test',{COLUMNS => ['info:uid','info:word'],STARTROW => '99980'} (查询出指定rowkey和列)
        get :获取单行数据
            get 'student','001' (获取一行数据)
            get 'student','003','cf1:name' (获取一行中的某一列数据)
            get 获取所有版本的数据
                修改版本数据
                alter 'student',{NAME => 'cf1',VERSIONS => 3}
                插入数据
                put 'test3','004','cf1:name','wangwu'
                put 'test3','004','cf1:name','xiaoming'
                put 'test3','004','cf1:name','xiaohua'
                获取所有版本的值
                get 'student','004',{COLUMNS => 'cf1:name',VERSIONS => 3}
        append : 向某一列的值后面追加
            append 'student','001','cf1:name','_good'
        count : 统计行数
         count 'tablename'
        delete : 删除某一个单元格 cell,默认删除最新的
            delete 'tablename','rowkey','columnFamily:column'
        deleteall :
            删除一行数据 :deleteall 'tablename','rowkey'
            删除一列数据 :deleteall 'tablename','rowkey','columnFamily:column'
        get_splits : 获取region的个数
            get_splits 'student'
        计数器 incr
            incr 'student','001','cf1:age'
        truncate :清空表
            truncate 'tablename'
        truncate_preserve :清空表
            只清空数据,不删除region的划分规则

原文地址:https://www.cnblogs.com/wangshuang123/p/10981605.html