Backup Management and Restoring from Backups

With these methods, you can run backups immediately, view the backups that currently exist in the cluster, and restore from a backup. Scheduling a backup to run periodically can be done through the scheduling api: Schedule management

Managing Backups  
List backups in the cluster. get-backups
List backups for a keyspace in the cluster. GET /{cluster_id}/backups/{ks_name}
List backups in the cluster with pagination. get-backups-paged
Run a backup immediately. POST /{cluster_id}/backups/run
Restoring from Backups  
Restore all data from a backup. POST /{cluster_id}/backups/restore/{tag}
Restore a specific keyspace from a backup. POST /{cluster_id}/backups/restore/{tag}/{ksname}
Restore a specific column family from a backup. POST /{cluster_id}/backups/restore/{tag}/{ksname}/{cfname}
managing-destinations  
List all the destinations. GET /{cluster_id}/backups/destinations
List a specific destination. GET /{cluster_id}/backups/destinations/{dname}
Add/Update a destination. POST /{cluster_id}/backups/destinations/{dname}
Delete a destination DELETE /{cluster_id}/backups/destinations/{id}

Managing Backups

GET /{cluster_id}/backups

Get a list of backups that exist in the cluster.

Path arguments:

cluster_id – A Cluster Config ID.

Opt. params:
  • match – A Job Schedule ID to limit backups to those created by a particular backup schedule.
  • last_seen – A backup tag to limit backups to those created before a particular backup.
  • amount – Number of backups ro return.

Returns a dictionary describing backpus in the cluster. Each key in the dictionary is the ID of the backup and each value is a dictionary describing the backup.

Example

curl http://127.0.0.1:8888/Test_Cluster/backups?last_seen=opscenter_adhoc_2012-04-20-10-41-12-UTC

Output:

{
  "opscenter_adhoc_2012-04-19-17-41-12-UTC": {
    "id": "adhoc",
      "keyspaces": {
          "OpsCenter": {
                "cfs": [
                    "events",
                    "events_timeline",
                    "rollups60",
                    ...
                ],
                "nodes": [
                    "127.0.0.1"
                ],
                "size": 23180
            },
            "system": {
                "cfs": [
                    "LocationInfo",
                    "Schema",
                    ...
                ],
                "nodes": [
                    "127.0.0.1"
                ],
                "size": 48961
            },
            "test": {
                "cfs": [
                    "cf1",
                    "cf2"
                ],
                "nodes": [
                    "127.0.0.1"
                ],
                "size": 4543
            }
        },
        "time": 1334857272
    }
}
GET /{cluster_id}/backups/{ks_name}

Get a list of backups that exist for a keyspace in the cluster.

Path arguments:
  • cluster_id – A Cluster Config ID.
  • ks_name – The keyspace scheduled for backup.

Returns data in the same format as get-backups.

POST /{cluster_id}/backups/run

Run a one time backup immediately.

Path arguments:cluster_id – A Cluster Config ID.
Body:A JSON dictionary containing the options to use for running this one-time backup.

Returns true to indicate a successful backup.

Example

Start a backup of two keyspaces immediately.

curl -X POST
  http://127.0.0.1:8888/Test_Cluster/backups/run
  -d '{"keyspaces": ["Keyspace1", "Keyspace2"]}'

Output:

The first true response indicates that the backup was successful for the specified node.

[
  true,
  [
    null,
    "10.11.12.150"
  ]
],
[
  true,
  [
    null,
    "10.11.12.152"
  ]
]

Note: You can schedule a one-time backup in the future using the POST /{cluster_id}/job-schedules. Specify an interval=-1 and interval_unit=null.

Restoring from Backups

POST /{cluster_id}/backups/restore/{tag}

Restore all data from a backup.

Path arguments:
  • cluster_id – A Cluster Config ID.
  • tag – The ID of a backup to restore. This must match one of the IDs returned by get-backups.
Body:

A JSON dictionary of options, including:

  • throttle: The streaming limit in MB/second. The default behavior is no throttle.
  • excluded-nodes: The list of nodes to exclude from the restore process.
  • force: True or false. True ignores problems, such as some nodes or agents being down, that normally abort restoration.
  • keyspaces: A dictionary mapping keyspace names to a dictionary of options specific to that keyspace. If this parameter is omitted, all keyspaces will be restored. If it is present, only the keyspaces listed in the dictionary will be restored. The set of accepted options per-keyspace include the following:
    • column-families: A list of specific column families to restore. If omitted, all column families will be restored. If omitted, all column families will be restored.
    • truncate: True or false. True first truncates all column families that will be restored. By default, column families are not truncated before restoration.

Returns a Request ID.

Example

BACKUP='opscenter_4a269167-96c1-40c7-84b7-b070c6bcd0cd_2012-06-07-18-00-00-UTC'
curl -X POST
    http://192.168.1.1:8888/Test_Cluster/backups/restore/$BACKUP
    -d '{
      "throttle": 10,
      "excluded-nodes": [
        "192.168.100.7"
      ],
      "keyspaces": {
        "Keyspace1": {
          "column-families: ["users", "dates"],
          "truncate": true
        },
        "OpsCenter": {
          "truncate": false
        }
      },
    }'

Output:

"fee2232c-48ac-11e2-b1b9-e0b9a54a6d93"
POST /{cluster_id}/backups/restore/{tag}/{ksname}

Restore a keyspace from a backup.

Path arguments:
  • cluster_id – A Cluster Config ID.
  • tag – The ID of a backup to restore. This must match one of the ID’s returned by get-backups.
  • ksname – A keyspace to restore.
Body:

A JSON dictionary of options, including:

  • throttle: The streaming limit in MB/second. The default behavior is no throttle.
  • excluded-nodes: The list of nodes to exclude from the restore process.
  • force: True or false. True ignores problems, such as some nodes or agents being down, that normally abort restoration.
  • column-families: A list of specific column families to restore. If omitted, all column families will be restored.
  • truncate: True or false. True first truncates all column families that will be restored. By default, column families are not truncated before restoration.

Returns a Request ID.

Example

BACKUP='opscenter_4a269167-96c1-40c7-84b7-b070c6bcd0cd_2012-06-07-18-00-00-UTC'
curl -X POST
    http://192.168.1.1:8888/Test_Cluster/backups/restore/$BACKUP/Keyspace1
    -d '{
      "throttle": 10,
      "excluded-nodes": [
        "192.168.100.7"
      ],
      "column-families: ["users", "dates"],
      "truncate": true
    }'

Output:

"fee2232c-48ac-11e2-b1b9-e0b9a54a6d93"
POST /{cluster_id}/backups/restore/{tag}/{ksname}/{cfname}

Restore a column family from a backup.

Path arguments:
  • cluster_id – A Cluster Config ID.
  • tag – The ID of a backup to restore. This must match one of the ID’s returned by get-backups.
  • ksname – A keyspace to restore.
  • cfname – A column family to restore.
Body:

A JSON dictionary of options, including:

  • throttle: The streaming limit in MB/second. The default behavior is no throttle.
  • excluded-nodes: The list of nodes to exclude from the restore process.
  • force: True or false. True ignores problems, such as some nodes or agents being down, that normally abort restoration.
  • truncate: True or false. True first truncates all column families that will be restored. By default, column families are not truncated before restoration.

Returns a Request ID.

Example

BACKUP='opscenter_4a269167-96c1-40c7-84b7-b070c6bcd0cd_2012-06-07-18-00-00-UTC'
curl -X POST
    http://192.168.1.1:8888/Test_Cluster/backups/restore/$BACKUP/Keyspace1/users
    -d '{
      "throttle": 10,
      "excluded-nodes": [
        "192.168.100.7"
      ],
      "truncate": true
    }'

Output:

"fee2232c-48ac-11e2-b1b9-e0b9a54a6d93"
GET /{cluster_id}/backups/destinations

Get a list of backup destinations that exist in for that cluster.

Path arguments:cluster_id – A Cluster Config ID.

Returns a dictionary describing the backups in the cluster. Each key in the dictionary is the name of the backup destination.

Example

curl http://127.0.0.1:8888/Test_Cluster/backups/destinations

Output:

{
    "testing_that": {
        "access-key": "AKIAIDGKF45VQXGUYIQQ",
        "access-secret": "gMizFwIoFHzIo7RrNmXUUd9zKea8hSkh6+wXLCT1",
        "path": "phalliday-opscenter-backups-1",
        "provider": "aws-s3"
    },
    "testing_this": {
        "access-key": "AKIAIDGKF45VQXGUYIQQ",
        "access-secret": "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",
        "path": "phalliday-opscenter-backups-1",
        "provider": "aws-s3"
    }
}
GET /{cluster_id}/backups/destinations/{dname}

Get a list of backup destinations that exist in for that cluster.

Path arguments:
  • cluster_id – A Cluster Config ID.
  • dname – The name of the backup destination

Returns a dictionary describing the attributes of the specific backups destination in the cluster.

Example

curl http://127.0.0.1:8888/Test_Cluster/backups/destinations/testing_this

Output:

{
    "access-key": "AKIAIDGKF45VQXGUYIQQ",
    "access-secret": "gMizFwIoFHzIo7RrNmXUUd9zKea8hSkh6+wXLCT1",
    "path": "phalliday-opscenter-backups-1",
    "provider": "aws-s3"
}
POST /{cluster_id}/backups/destinations/{dname}

Get a list of backup destinations that exist in for that cluster.

Path arguments:
  • cluster_id – A Cluster Config ID.
  • dname – The name of the backup destination

Returns a dictionary describing the attributes of the specific backups destination in the cluster and the id of the request that updates all the agents with the new destination

Example

curl -X POST
     http://127.0.0.1:8888/Test_Cluster/backups/destinations/testing_this
     -d '{
        "access-key": "AKIAIDGKF45VQXGUYIQQ",
        "access-secret": "gMizFwIoFHzIo7RrNmXUUd9zKea8hSkh6+wXLCT1",
        "path": "phalliday-opscenter-backups-1",
        "provider": "aws-s3"
     }'

Output:

{
    destination: {
        "access-key": "AKIAIDGKF45VQXGUYIQQ",
        "access-secret": "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",
        "path": "phalliday-opscenter-backups-1",
        "provider": "aws-s3"
    },
    request_id: "06747042-5a9a-45e7-8fa0-297abb68448f"
}
DELETE /{cluster_id}/backups/destinations/{id}

Deletes a backup destination for a cluster.

Path arguments:
  • cluster_id – A Cluster Config ID.
  • id – The id of the destination to delete

Returns the id of the request that removes the destinations for all agents

Example

curl -X DELETE
     http://127.0.0.1:8888/Test_Cluster/backups/destinations/fee2232c-48ac-11e2-b1b9-e0b9a54a6d93

Output:

"06747042-5a9a-45e7-8fa0-297abb68448f"