Table Data Migration (you can specify a timestamp to export the data method)

Source: Internet
Author: User

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:

    • starttimeBeginning of the time range. Without endtime means starttime to forever.
    • endtimeEnd of the time range. Without endtime means starttime to forever.
    • versionsNumber of cell versions to copy.
    • new.nameNew table ' s name.
    • peer.adrAddress of the peer cluster given in the format hbase.zookeeper.quorum:hbase.zookeeper.client.port: Zookeeper.znode.parent
    • familiescomma-separated List of columnfamilies to copy.
    • all.cellsAlso 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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.