Note:

Create HBase Snapshot Backup and Restore in Oracle Big Data Service

Introduction

HBase snapshots allow efficient backups and restores of tables across clusters. This tutorial demonstrates how to create a snapshot in a source cluster, export it to an Oracle Cloud Infrastructure (OCI) bucket, and restore it in a target cluster.

Objectives

Prerequisites

Task 1: Create a Table and Populate Data in Source Cluster

  1. Create a table and add some data using the following command.

    hbase> create 'table1', 'cf1'
    hbase> put 'table1', '1', 'cf1:age', '30'
    hbase> put 'table1', '2', 'cf1:name', 'John'
    
  2. Verify the data is populated correctly using the following command.

    hbase> scan 'table1'
    

Task 2: Take a Snapshot of the Table

  1. Create a snapshot for the table using the following command.

    hbase> snapshot 'table1', 'table1-snapshot'
    
  2. List the snapshots to confirm using the following command.

    hbase> list_snapshots
    

Task 3: Export the Snapshot to an OCI Bucket

  1. Export the snapshot to an OCI bucket using the following command.

    hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot table1-snapshot -copy-to oci://<bucket>@<namespace>/<path> -mappers 16
    
  2. Verify the snapshot files are copied using the following command.

    hadoop fs -ls oci://<bucket>@<namespace>/<path>/
    

Task 4: Import the Snapshot into the Target Cluster

  1. Copy the snapshot from the OCI bucket to the target cluster using the following command.

    hbase org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot table1-snapshot -copy-from oci://<bucket>@<namespace>/<path> -copy-to /apps/hbase/data -mappers 16
    
  2. Confirm the snapshot is available in the target cluster using the following command.

    hbase> list_snapshots
    

Task 5: Restore the Snapshot in the Target Cluster

  1. Restore the table from the snapshot using the following command.

    hbase> restore_snapshot 'table1-snapshot'
    
  2. Scan the restored table to verify the data using the following command.

    hbase> scan 'table1'
    

Troubleshooting and Tips

Next Steps

Consider using Oozie or cron jobs to automatically schedule regular snapshot exports to OCI buckets.

Acknowledgements

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.