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的劃分規則shell

相關文章
相關標籤/搜索