Backing up a COD table

You can backup your Cloudera Operational Database (COD) table by creating a snapshot of the table and exporting it to your S3, HDFS, or ABFS bucket.

Create snapshot command takes a snapshot of the HBase table, exports the snapshot to the specified storage location, and deletes the snapshot from HBase after the export to the specified storage location is successful.
  • Ensure that you have access to the location where you want to take the backup of the table.
  • You have an S3 or ABFS bucket which you want to use to backup an HBase table in COD. For example: s3a://cod-backups/hbase
  • You have an edge node configured for your COD database. For more information, see Configure Edge Nodes.
  1. Run the following command using cdpcli-beta.
    cdp opdb create-snapshot --environment-name ENVIRONMENT_NAME --database-name DATABASE_NAME --table-name TABLE_NAME --snapshot-name SNAPSHOT_NAME --snapshot-location SNAPSHOT_LOCATION
    For example,
    cdp opdb create-snapshot --environment-name odx-wgel6j --database-name jpfy --table-name table_6uf7xt --snapshot-name s1 --snapshot-location s3a://cod-7215/cod--yq3p370r6qro/backupdata
    JSON output:
    {
        "environmentName": "odx-wgel6j",
        "databaseName": "jpfy",
        "status": "IN_PROGRESS",
        "creationTime": 0,
        "commandID": 1546336350
    }
  2. Validate that the snapshot and data is present using the list-snapshots command.
    The following command lists the snapshots created in the environment against the COD database filters like table name, command ID, and time range.

    cdp opdb list-snapshots --environment-name ENVIRONMENT_NAME --database-name DATABASE_NAME [--table-name TABLE_NAME] [--command-id COMMAND_ID] [--from-creation-time FROM_CREATION_TIME] [--to-creation-time TO_CREATION_TIME]

    Examples

    Without filters
    cdp opdb list-snapshots  --environment-name odx-wgel6j --database-name jpfy
    
    {
        "environmentName": "odx-wgel6j",
        "databaseName": "jpfy",
        "snapshots": [
            {
                "tableName": "table_tob8vc",
                "snapshotName": "snapshot3_table_tob8vc",
                "creationTime": 1662014265011,
                "status": "SUCCESSFUL",
                "commandID": 1546336058,
                "snapshotLocation": "abfs://qedailynat-filesystem@qedailynatstorageaccount.dfs.core.windows.net/cod-rtzupxh843ua/hbase"
            },
            {
                "tableName": "table_tob8vc",
                "snapshotName": "snapshot2_table_tob8vc",
                "creationTime": 1662014023725,
                "status": "SUCCESSFUL",
                "commandID": 1546336035,
                "snapshotLocation": "abfs://qedailynat-filesystem@qedailynatstorageaccount.dfs.core.windows.net/cod-rtzupxh843ua/hbase"
            },
            {
                "tableName": "table_tob8vc",
                "snapshotName": "snapshot1_table_tob8vc",
                "creationTime": 1662013782370,
                "status": "DELETED",
                "commandID": 1546336077,
                "snapshotLocation": "abfs://qedailynat-filesystem@qedailynatstorageaccount.dfs.core.windows.net/cod-rtzupxh843ua/hbase"
            },
            {
                "tableName": "table_lpirwy",
                "snapshotName": "snapshot_table_lpirwy",
                "creationTime": 1662013568312,
                "status": "DELETED",
                "commandID": 1546336004,
                "snapshotLocation": "abfs://qedailynat-filesystem@qedailynatstorageaccount.dfs.core.windows.net/cod-rtzupxh843ua/hbase"
            }
    ]
    }
    With command ID filter
    $ cdp opdb list-snapshots  --environment-name odx-wgel6j --database-name jpfy --command-id 1546336385
    {
        "environmentName": "odx-wgel6j",
        "databaseName": "jpfy",
        "snapshots": [
            {
                "tableName": "table_6uf7xt",
                "snapshotName": "s2",
                "creationTime": 1662035967244,
                "status": "SUCCESSFUL",
                "commandID": 1546336385,
                "snapshotLocation": "abfs://qedailynat-filesystem@qedailynatstorageaccount.dfs.core.windows.net/cod-rtzupxh843ua/hbase/"
            }
        ]
    }
    With table name filter
    $ cdp opdb list-snapshots  --environment-name odx-wgel6j --database-name jpfy --table-name table_6uf7xt
    {
        "environmentName": "odx-wgel6j",
        "databaseName": "jpfy",
        "snapshots": [
            {
                "tableName": "table_6uf7xt",
                "snapshotName": "s2",
                "creationTime": 0,
                "status": "SUCCESSFUL",
                "commandID": 1546336385,
                "snapshotLocation": "abfs://qedailynat-filesystem@qedailynatstorageaccount.dfs.core.windows.net/cod-rtzupxh843ua/hbase/"
            }
        ]
    }