hbase shell创建表命令

create 'ucbrowser_imei2', {NAME=>'date', VERSIONS=>5}

disable 'test_imei'

drop 'test_imei'

# 预先指定分区
create 'ucbrowser_utdid', 'date', { VERSIONS => '5', DATA_BLOCK_ENCODING => 'PREFIX', COMPRESSION => 'SNAPPY', SPLITS=>['03ufUX/IWscQABV+EwvaHDOo']}
# 预先分区(200个region)
hbase org.apache.hadoop.hbase.util.RegionSplitter -c 200 -f "date" "ucbrowser_imei2" "HexStringSplit"

# 修改版本
alter 'test_imei', {NAME => 'date', VERSIONS => 5 }

# 查看表描述
describe "test_imei"

snapshot

# 在原集群执行
snapshot 'ucbrowser_utdid', 'ucbrowser_utdid_20171208'

# 导出镜像
hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot ucbrowser_utdid_20171208 -copy-to hdfs://10.xx.xx.xx:8020/hbase 

# 检查目标集群的文件权限是否正确
hdfs dfs chown -R hbase:hbase /hbase/archive

# 在目标集群恢复
disable  'ucbrowser_utdid'
restore_snapshot 'ucbrowser_utdid_20171208'

# 查看镜像
list_snapshots

 

HBase备份之ExportSnapshot或CopyTable

updatedupdated2023-12-062023-12-06