Managing backups

Once you’ve got the DSE Backup and Restore Service enabled, a user assigned the backup role, and a backup configuration created, you’re ready to work with actual backups. Generally you’ll deal with backups that have been automatically created using the scheduling criteria you’ve established in a backup configuration. However, you can also run a manual backup.

Backup operations encompass:

  • Running a manual backup

  • Listing existing backups

  • Cancelling a manual backup in progress

  • Culling stale backups falling outside your established retention period

Run a manual backup

To run a manual backup:

  1. Start cqlsh and list your existing backup configurations:

    LIST BACKUP CONFIGURATIONS;
    
     name          | target_keyspace | stores              | frequency         | enabled | next_execution_time
    ---------------+-----------------+---------------------+-------------------+---------+---------------------
     <config_name> |       <keyspace>| ['<backup_store>'] | <cron_expression> |   False |           null

    Make note of the <config_name>.

    If no backup configurations are listed, see: Creating and managing backup configurations.

  2. Run a manual backup substituting <config_name> for your backup configuration name:

    RUN BACKUP >;
    
    backup_id
    -----------------------------------------------------------------------
     <config_name>-<UUID>

    You can use the <backup_id>-<UUID> to cancel long running manual backups if required.

Check on the status of running backups

For large datasets a backup may take some time to finish.

To check the status of long running backups:

  1. List the existing backups:

    LIST BACKUPS FROM KEYSPACE <keyspace>;
    
     id                    | backup_time | store         | keyspace   | tables                    | nodes       | schema_versions | status   | details
    -----------------------+-------------+---------------+------------+---------------- ----------+-------------+-----------------+----------+------------------
     config_name-UUID      | timestamp   | store_name    | keyspace   | {'table1', 'table2'}      | {node_id}   | schema_status   | status   | status_details
  2. Note the <config_name>-<UUID> and then run the following query:

    SELECT * FROM system_distributed.backup_task_state WHERE backup_id = '<config_name>-<UUID>' ALLOW FILTERING;
    
    backup_config_name | backup_id         | node_id | retry_count | error_message | error_stacktrace | metrics       | state    | transitioned_at  | type
    -------------------+-------------------+---------+-------------+---------------+----------------------------------+----------+------------------+--------------
         config_name   | config_name-UUID  | node_id |           N |         error |       stacktrace |   metrics_map | FINISHED | timestamp        | backup_type
    
    (1 rows)

    Completed backups will have the state FINISHED.

List existing backups

To list existing backups:

  1. Start cqlsh and list your existing backup configurations:

    LIST BACKUP CONFIGURATIONS;
    
     name        | target_keyspace | stores           | frequency       | enabled | next_execution_time
    -------------+-----------------+------------------+-----------------+---------+---------------------
     config_name |       keyspace  | ['backup_store'] | cron_expression |   False |           null

    Make note of the target <keyspace> for the backup configuration.

  2. List the backups for the target keyspace to verify that the backup has completed successfully:

    LIST BACKUPS FROM KEYSPACE <keyspace>;
    
     id                | backup_time | store      | keyspace | tables               | nodes     | schema_versions | status | details
    -------------------+-------------+------------+----------+----------------------+-----------+-----------------+--------+------------------
     config_name-UUID  | timestamp   | store_name | keyspace | {'table1', 'table2'} | {node_id} | schema_status   | status | status_details

    The following table describes the information returned:

    Backup details
    Column name Description Type

    id

    Backup ID.

    Text

    backup_time

    The time at which the backup started.

    Timestamp

    store

    The store where the backup is located.

    Text

    keyspace

    Keyspace name.

    Text

    tables

    Names of the tables in the backup.

    Text set

    nodes

    Names of the nodes that performed the backup.

    UUID set

    status

    The status of the backup:

    • FULL_BACKUP: all nodes successfully performed the backup.

    • QUORUM_BACKUP: a quorum of nodes, according the keyspace replication factor, sucessfully performed the backup.

    • INCOMPLETE_BACKUP: too many nodes failed the backup. An incomplete backup cannot be restored.

    • CLEANING: the backup is being cleaned. See CLEAN BACKUPS.

    Text

    schema_versions

    Status of the schema agreement between nodes:

    • IN AGREEMENT: the schema for all nodes is in agreement.

    • MISMATCH: there is a schema mismatch within the nodes. The resulting backup cannot be restored.

    Text

    details

    Information on the backup status.

    Text

Cancel a backup in progess

To cancel a backup in progress:

  1. Start cqlsh and list your existing backup configurations:

    LIST BACKUP CONFIGURATIONS;
    
     name        | target_keyspace | stores           | frequency       | enabled | next_execution_time
    -------------+-----------------+------------------+-----------------+---------+---------------------
     config_name |       keyspace  | ['backup_store'] | cron_expression |   False |           null

    Make note of the target <keyspace> for the backup configuration.

  2. Note the <config_name>-<UUID> and then run the following query:

    SELECT * FROM system_distributed.backup_task_state WHERE backup_id = '<config_name>-<UUID>' ALLOW FILTERING;
    
    backup_config_name | backup_id        | node_id | retry_count | error_message | error_stacktrace | metrics     | state    | transitioned_at | type
    -------------------+------------------+---------+-------------+---------------+------------------+-------------+----------+-----------------+------------
           config_name | config_name-UUID | node_id |           N |         error |       stacktrace | metrics_map | FINISHED | timestamp       | backup_type
    
    (1 rows)

    Backups in progress have the status STARTED or UPLOADING.

  3. Cancel the running backup:

    CANCEL <config_name>-<UUID>;

Clean up stale backups

Although a scheduled task runs every two hours to drop backups that are outside of backup store’s configured retention policy for a backup store (see Customize backup retention policy), you can manually run a backup cleaning if you wish. For information on manually cleaning backups, see CLEAN BACKUPS.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com