Note:
- This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
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
-
Create and manage HBase snapshots.
-
Export and import snapshots between clusters using OCI buckets.
-
Restore snapshots to retrieve table data in the target cluster.
Prerequisites
-
Deploy and run OCI source and target Oracle Big Data Service cluster.
-
A configured OCI bucket for storing snapshots.
-
Basic knowledge of HBase commands and operations.
Task 1: Create a Table and Populate Data in Source Cluster
-
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'
-
Verify the data is populated correctly using the following command.
hbase> scan 'table1'
Task 2: Take a Snapshot of the Table
-
Create a snapshot for the table using the following command.
hbase> snapshot 'table1', 'table1-snapshot'
-
List the snapshots to confirm using the following command.
hbase> list_snapshots
Task 3: Export the Snapshot to an OCI Bucket
-
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
-
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
-
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
-
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
-
Restore the table from the snapshot using the following command.
hbase> restore_snapshot 'table1-snapshot'
-
Scan the restored table to verify the data using the following command.
hbase> scan 'table1'
Troubleshooting and Tips
-
Snapshot Consistency: Ensure that no modifications are made to the table during snapshot creation to avoid inconsistencies.
-
Storage Path Verification: Verify the correct paths for the snapshot export and import processes.
Next Steps
Consider using Oozie or cron jobs to automatically schedule regular snapshot exports to OCI buckets.
Related Links
Acknowledgements
- Authors - Pavan Upadhyay (Principal Cloud Engineer), Saket Bihari (Principal Cloud Engineer)
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.
Create HBase Snapshot Backup and Restore in Oracle Big Data Service
G25510-01
January 2025
Copyright ©2025, Oracle and/or its affiliates.