HBASE snapshots How To

What is a Snapshot?

A snapshot is a set of metadata information that allows an admin to get back to a previous state of the table. A snapshot is not a copy of the table; it’s just a list of file names and doesn’t copy the data. A full snapshot restore means that you get back to the previous “table schema” and you get back your previous data losing any changes made since the snapshot was taken.

 

1.Taking a snapshot

hbase(main):013:0> snapshot ‘kafka_offset’, ‘kafka_offset.snapshot’

0 row(s) in 0.3850 seconds

 2.List snap shots

 hbase(main):014:0> list_snapshots

SNAPSHOT                             TABLE + CREATION TIME

 kafka_offset.snapshot               kafka_offset (Mon Mar 12 14:37:47 +0100 2018)

1 row(s) in 0.0160 seconds

3.Remove snapshot

 hbase(main):016:0> delete_snapshot ‘kafka_offset.snapshot’

0 row(s) in 0.0260 seconds

4. Restore snapshot

hbase(main):016:0> restore_snapshot ‘kafka_offset.snapshot’

 5.To export an existing snapshot to another cluster, use the ExportSnapshot tool.

 hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot

SnapshotName -copy-to hdfs:///srv2:8082/hbase

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s