Hbase表重命名 表改名

若如初见. 提交于 2020-01-18 07:05:30
本文转载自:https://www.cnblogs.com/tnsay/p/5781064.html 作者:tnsay 转载请注明该声明。

PS:现在我有个表 :test11_new  ,我要给他改名

 

开始:

 

1、先disable掉表
hbase(main):023:0> disable 'test11_new' 0 row(s) in 1.2290 seconds
2、创建一个快照
hbase(main):024:0> snapshot 'test11_new', 'test11_newSnapshot' 0 row(s) in 0.3500 seconds
3、克隆这个快照 赋给新的表名
hbase(main):025:0> clone_snapshot 'test11_newSnapshot', 'test111' 0 row(s) in 0.7280 seconds
4、删除之前创建的快照
hbase(main):026:0> delete_snapshot 'test11_newSnapshot' 0 row(s) in 0.0290 seconds
5、再删除掉之前的表
hbase(main):027:0> drop 'test11_new' 0 row(s) in 0.3800 seconds

 

新的表名如上  再scan一下

hbase(main):029:0> scan 'test111'
ROW                                                                  COLUMN+CELL                                                                                                                                                                                              
 row1                                                                column=info:lie1, timestamp=1470305378723, value=zhi1                                                                                                                                                    
 row1                                                                column=info:lie2, timestamp=1470305399560, value=zhi2                                                                                                                                                    
 row1                                                                column=info:lie3, timestamp=1470305437650, value=zhi33                                                                                                                                                   
1 row(s) in 0.0170 seconds

 

ok,到此结束!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!