Often during development and sometimes in production backup of a HBase table need to be made, for e.g., to run a test code against a table during development and being able to restore the original data if some thing went wrong or create a clone of the existing table or move table data to a new development cluster. HBase provides the option of taking snapshot of tables which can be used in such scenarios. The following are the various hbase shell commands to accomplish some of the common requirements.
Create a snapshot of HBase table
1 2 3 4
For easier identification it is a good practice to create snapshot with table name, creation date, creation time in the snapshot name.
Restore data from snapshot
1 2 3 4 5 6 7 8
Note that the table need to be disabled to restore the table data from snapshot. Also note that any updates to the table data after the snapshot will be lost once the restoration is complete.
Clone table from snapshot
1 2 3 4
A new table will be created with the attributes of the original table from which the snap shot was made and the data from the point in time of the snapshot will be restored.
List all the available snapshots for a table If multiple snapshots were made on tables and would like to see the list of available snapshots
1 2 3 4 5 6 7