1 copytable Tools
Usage:
Copytable is a utility so can copy part or of all of a table, either to the same cluster or another cluster. The target table must first exist. The usage is as follows:
$ bin/hbase org.apache.hadoop.hbase.mapreduce.CopyTable [--starttime=x] [--endtime=y] [--new.name=new] [--peer.adr= ADR] TableName
Options:
starttime
Beginning of the time range. Without endtime means starttime to forever.
endtime
End of the time range. Without endtime means starttime to forever.
versions
Number of cell versions to copy.
new.name
New table ' s name.
peer.adr
Address of the peer cluster given in the format hbase.zookeeper.quorum:hbase.zookeeper.client.port: Zookeeper.znode.parent
families
comma-separated List of columnfamilies to copy.
all.cells
Also Copy Delete markers and uncollected deleted cells (advanced option).
Args:
- TableName Name of table to copy.
Example of copying ' testtable ' to a cluster this uses replication for a 1 hour window:
$ bin/hbase org.apache.hadoop.hbase.mapreduce.copytable--starttime=1265875194289--endtime=1265878794289-- Peer.adr=server1,server2,server3:2181:/hbase TestTable
Scanner Caching
Caching for the input Scan was configured via in the hbase.client.scanner.caching
job configuration.
Versions
By default, copytable utility only copies the latest version of row cells unless are --versions=n
explicitly specified in the Comm and.
See Jonathan Hsieh's Online HBase Backups with copytable blog post for more on copytable.
2 Export and Import tools
Export is a utility, that would dump the contents of table to HDFS in a sequence file. Invoke via:
$ bin/hbase org.apache.hadoop.hbase.mapreduce.Export <tablename> <outputdir> [<versions> [< starttime> [<endtime>]]
Note:caching for the input Scan was configured via in the hbase.client.scanner.caching
job configuration.
$ bin/hbase org.apache.hadoop.hbase.mapreduce.Export <tablename> <outputdir> [<versions> [< starttime> [<endtime>]]
Import is a utility that would load data that have been exported back into HBase. Invoke via:
$ bin/hbase org.apache.hadoop.hbase.mapreduce.Import <tablename> <inputdir>
To import 0.94 exported files in a 0.96 cluster or onwards, you need to set system property "Hbase.import.version" When Ru Nning the import command as below:
$ bin/hbase-dhbase.import.version=0.94 org.apache.hadoop.hbase.mapreduce.Import <tablename> <inputdir>
Specific usage of the Export band Time range: HBase org.apache.Hadoop.hbase.mapreduce.Export member5 HDFS://MASTER24:9000/USER/HADOOP/DUMP2 1 1401938590466 1401938590467
Export path to HDFs path, write full path.
The imported table must be pre-defined.
Table Data Migration (you can specify a timestamp to export the data method)