habse的CopyTable

需求:对hbase的一张表进行拷贝

一、table1的内容如下

hbase(main):018:0> scan 'table1'
ROW                                              COLUMN+CELL                                                                                                                                 
 1                                               column=f1:age, timestamp=1469069255119, value=10                                                                                            
 1                                               column=f1:gender, timestamp=1469069255119, value=male                                                                                       
 1                                               column=f1:name, timestamp=1469069255119, value=zhangsan                                                                                     
 2                                               column=f1:name, timestamp=1469069255119, value=lisi                                                                                         
 3                                               column=f1:name, timestamp=1469069255119, value=wangwu                                                                                       
 4                                               column=f1:birthday, timestamp=1469069255119, value=1993                                                                                     
 4                                               column=f1:name, timestamp=1469069255119, value=zhaoliu                                                                                      
4 row(s) in 0.0300 seconds

二、现在将table1拷贝

hbase org.apache.hadoop.hbase.mapreduce.CopyTable --new.name=table2 table1

三、scan table2中的数据

hbase(main):026:0> scan 'table2'
ROW                                              COLUMN+CELL                                                                                                                                 
 1                                               column=f1:age, timestamp=1469069255119, value=10                                                                                            
 1                                               column=f1:gender, timestamp=1469069255119, value=male                                                                                       
 1                                               column=f1:name, timestamp=1469069255119, value=zhangsan                                                                                     
 2                                               column=f1:name, timestamp=1469069255119, value=lisi                                                                                         
 3                                               column=f1:name, timestamp=1469069255119, value=wangwu                                                                                       
 4                                               column=f1:birthday, timestamp=1469069255119, value=1993                                                                                     
 4                                               column=f1:name, timestamp=1469069255119, value=zhaoliu                                                                                      
4 row(s) in 0.0260 seconds
posted @ 2016-07-21 11:41  dongdone  阅读(478)  评论(0编辑  收藏  举报