美文网首页HBASE 知识整理
HBase Snapshot 相关命令学习

HBase Snapshot 相关命令学习

作者: 步闲 | 来源:发表于2019-12-19 13:48 被阅读0次
    1. clone_snapshot

    根据快照恢复一个宽表,恢复过程不涉及数据移动,可以在秒级完成。

    hbase(main):003:0> help 'clone_snapshot'
    Create a new table by cloning the snapshot content.
    There're no copies of data involved.
    And writing on the newly created table will not influence the snapshot data.
    
    Examples:
      hbase> clone_snapshot 'snapshotName', 'tableName'
      hbase> clone_snapshot 'snapshotName', 'namespace:tableName'
    
    Following command will restore all acl from origin snapshot table into the
    newly created table.
    
      hbase> clone_snapshot 'snapshotName', 'namespace:tableName', {RESTORE_ACL=>true}
    
    1. delete_all_snapshot

    删除所有快照,支持正则。

    hbase(main):004:0> help 'delete_all_snapshot'
    Delete all of the snapshots matching the given regex. Examples:
    
      hbase> delete_all_snapshot 's.*'
    
    1. delete_snapshot

    删除指定快照。

    hbase(main):005:0> help 'delete_snapshot'
    Delete a specified snapshot. Examples:
    
      hbase> delete_snapshot 'snapshotName',
    
    1. list_snapshots

    列出所有的快照,支持*匹配。

    hbase(main):006:0> help 'list_snapshots'
    List all snapshots taken (by printing the names and relative information).
    Optional regular expression parameter could be used to filter the output
    by snapshot name.
    
    Examples:
      hbase> list_snapshots
      hbase> list_snapshots 'abc.*'
    
    1. restore_snapshot

    用于恢复指定快照,恢复过程会替代原有数据,将表恢复到快照点,快照之后的所有更新将会丢失。表必须disable.

    hbase(main):007:0> help 'restore_snapshot'
    Restore a specified snapshot.
    The restore will replace the content of the original table,
    bringing back the content to the snapshot state.
    The table must be disabled.
    
    Examples:
      hbase> restore_snapshot 'snapshotName'
    
    Following command will restore all acl from snapshot into the table.
    
      hbase> restore_snapshot 'snapshotName', {RESTORE_ACL=>true}
    
    1. snapshot

    为表打一个快照,但并不涉及数据移动。

    hbase(main):008:0> help 'snapshot'
    Take a snapshot of specified table. Examples:
    
      hbase> snapshot 'sourceTable', 'snapshotName'
      hbase> snapshot 'namespace:sourceTable', 'snapshotName', {SKIP_FLUSH => true}
    
    1. snapshot_all

    为所有的表创建快照,快照名按系统规则生成,大约是这个样子:dalishen_ns_sep_test_zpb-ru-20191219

    hbase(main):009:0> help 'snapshot_all'
    List all tables and take snapshot .
    Optional regular expression parameter could be used to filter the output
    by table name.
    
    Examples:
      hbase> snapshot_all
      hbase> snapshot_all 'abc.*'
    
    1. snapshot_restore

    暂时不明

    hbase(main):010:0> help 'snapshot_restore'
    Use snapshot to restore tables.
    Date parameter (in the form YYYY-mm-dd) is used to filter the snapshots
    
    Examples:
      hbase> snapshot_restore '2014-12-09'
    
    1. Snapshot 两阶段提交:1.acquired 2.reached/abort

    原理:zk 3节点保证。

    ls /${hbaserootdir}/online-snapshot
    ./acquired
    ./abort
    ./reached
    

    相关文章

      网友评论

        本文标题:HBase Snapshot 相关命令学习

        本文链接:https://www.haomeiwen.com/subject/iaumnctx.html