Creating and managing backup configurations
Before you can actually run a backup, you’ll need to configure a backup configuration for each of your backup stores. Backup configurations comprise the following required parameters:
-
A configuration name.
-
The name of the keyspace you want to back up.
You can only assign one keyspace to a backup configuration. You cannot backup individual tables within a keyspace.
-
The name of the backup store or stores in which to store the keyspace backup.
-
The frequency at which the backup should be run.
-
Whether the backup should run automatically using the specified frequency.
If the backup is disabled, the frequency is ignored.
Create an automatic backup configuration
An automatic backup configuration will backup the specified keyspace to the specified backup store at the time specified by the frequency parameter, which is a standard cron expression.
To create an automatic backup configuration:
-
Open cqlsh and list the existing backup stores:
LIST BACKUP STORES; name | class | settings --------------+------------------------------------------------------+-------------------------- <store_name> | com.datastax.bdp.db.backups.destinations.FSBlobStore | {'path': '/<full_path>'}
-
Create the new backup configuration:
-
<config_name> with a name of your choice. Configuration names can use alphanumeric characters and underscores only. They are case insensitive.
-
<keyspace> with the keyspace to backup.
-
<backup_store> with the name of the backup store to use.
You can specify multiple stores for the backup by separating them with commas. Backups are then stored in each backup store, for instance one in a
FSBlobStore
and one in aS3BlobStore
. -
<cron_expression> with a standard cron expression, for example, daily at midnight:
0 0 * * *
Easily generate cron timing expressions using https://crontab-generator.org/. Note that shortcuts such as
*/30 * * * *
to run a backup every 30 minutes are not supported. -
enabled
set totrue
.CREATE BACKUP CONFIGURATION <config_name> OF <keyspace> TO STORE <backup_store> WITH frequency = '<cron_expression>' AND enabled = true;
For more information, see CREATE BACKUP CONFIGURATION.
-
-
Verify that the backup configuration was created:
LIST BACKUP CONFIGURATIONS; name | target_keyspace | stores | frequency | enabled | next_execution_time ---------------+-----------------+---------------------+-------------------+---------+--------------------- <config_name> | <keyspace>| ['<backup_store>'] | <cron_expression> | True | <timestamp>
Create a manual backup configuration
The only difference between an automatic backup configuraton and a manual backup configuration is that enabled
is set to <false>.
The frequency parameter is ignored and the backup configuration can only be run manually.
To create a manual backup configuration:
-
Open cqlsh and list the existing backup stores:
LIST BACKUP STORES; name | class | settings --------------+------------------------------------------------------+-------------------------- store_name | com.datastax.bdp.db.backups.destinations.FSBlobStore | {'path': '/full_path'}
-
Create the new backup configuration:
-
<config_name> with a name of your choice. Configuration names can use alphanumeric characters and underscores only. They are case insensitive.
-
<keyspace> with the keyspace backup.
-
<backup_store> with the name(s) of the backup store to use.
You can specify multiple stores for the backup by separating them with commas. Backups are then stored in each backup store, for instance one in a FSBlobStore and one in a S3BlobStore.
-
<cron_expression> with five asterisks:
* * * * *
because it is ignored. -
enabled
set tofalse
.CREATE BACKUP CONFIGURATION <config_name> OF <keyspace> TO STORE <backup_store> [, <backup_store_N>] WITH frequency = '* * * * *' AND enabled = false;
For more information, see CREATE BACKUP CONFIGURATION.
-
-
Verify that the backup configuration was created:
LIST BACKUP CONFIGURATIONS; name | target_keyspace | stores | frequency | enabled | next_execution_time -------------+-----------------+------------------+-----------+----------+--------------------- config_name | keyspace | ['backup_store'] | * * * * * | False | null
Alter and drop backup configurations
You can alter existing backup configurations and drop backup configurations you no longer need.
To alter an existing backup configuration:
-
List your existing backup configurations:
LIST BACKUP CONFIGURATIONS; name | target_keyspace | stores | frequency | enabled | next_execution_time -------------+-----------------+------------------+-----------+----------+--------------------- config_name | keyspace | ['backup_store'] | * * * * * | False | null
-
Alter the backup configuration settings as required:
-
Add an additional backup store to the backup configuration:
ALTER BACKUP CONFIGURATION <config_name> ADD STORE <store_name>;
-
Remove a backup store from the backup configuration:
ALTER BACKUP CONFIGURATION <config_name> DROP STORE <store_name>;
-
Modify the frequency of the backup configuration:
ALTER BACKUP CONFIGURATION <config_name> WITH <frequency>;
-
For more information, see ALTER BACKUP CONFIGURATION. |
To drop an existing backup configuration:
-
List your existing backup configurations:
LIST BACKUP CONFIGURATIONS; name | target_keyspace | stores | frequency | enabled | next_execution_time -------------+-----------------+------------------+-----------+----------+--------------------- config_name | keyspace | ['backup_store'] | * * * * * | False | null
-
Drop an existing backup configuration:
DROP BACKUP CONFIGURATION <config_name>;
For more information, see DROP BACKUP CONFIGURATION. |
What to do next
With the backup store and the backup configuration created, continue to Managing backups.