Jump to: navigation, search

Difference between revisions of "Cross-region-backup-availability"

(Public API)
(CLI interface)
 
(13 intermediate revisions by the same user not shown)
Line 17: Line 17:
 
===Public API===
 
===Public API===
 
Currently, to create a backup, a POST is sent to /backups specifying the instance ID among other required fields. Trove then create a backup for that instance and stores it.
 
Currently, to create a backup, a POST is sent to /backups specifying the instance ID among other required fields. Trove then create a backup for that instance and stores it.
With this feature, the backup is created by providing a location reference that points to the location of the source backup instead of the instance ID. Trove will then fetch the source backup, creates a record and push the backup to its storage.
+
With this feature, the backup is created by providing a backup reference that points to the location of the source backup instead of the instance ID. Trove will then fetch the source backup, creates a record and push the backup to its storage.
  
 
Here how the API would look:
 
Here how the API would look:
Line 26: Line 26:
 
         {
 
         {
 
             "description": "Backup from a different region",
 
             "description": "Backup from a different region",
             "location": "http://region1.trove.com:8080/v1/tenant/database_backups/cdb59309-7a07-44c4-9187-edf1f006546f.xbstream.gz.enc",
+
             "backup": {
 +
                "region": "another-region",
 +
                "id": "the-source-backup-id"
 +
            },
 
             "instance": null,
 
             "instance": null,
 
             "name": "backup-from-different-region"
 
             "name": "backup-from-different-region"
Line 41: Line 44:
 
             "id": "aeb6fa4c-932d-4acc-a339-cccfb9f300b2",
 
             "id": "aeb6fa4c-932d-4acc-a339-cccfb9f300b2",
 
             "instance_id": null,
 
             "instance_id": null,
             "locationRef": "http://region2.trove.com:8080/v1/tenant1/database_backups/aeb6fa4c-932d-4acc-a339-cccfb9f300b2.xbstream.gz.enc",
+
             "locationRef": "http://my-region.trove.com:8080/v1/tenant1/database_backups/aeb6fa4c-932d-4acc-a339-cccfb9f300b2.xbstream.gz.enc",
 
             "name": "backup-from-different-region",
 
             "name": "backup-from-different-region",
 
             "status": "COMPLETED",
 
             "status": "COMPLETED",
Line 49: Line 52:
 
     }
 
     }
 
====CLI interface====
 
====CLI interface====
 +
For CLI, there will be a ''backup-copy'' subcommand that will take params: 'name' and 'backup', which correspond to the name to be assigned to the new backup and the backup id of the source backup. Optionally, it will take a 'description' and a 'region'. The 'region' will allow you to copy backups from a different region.
  
How the command will look like?
+
===Internal API===
Does it extends the already existed command interfaces ?
+
The ''create_backup'' RPC method in the taskmanager will be modified to take an optional ''backup_ref'' value. The taskmanager will use this reference to fetch the source backup from globally accessible storage (different region) and push it to the trove's storage.
====ReST Part====
 
  
Which HTTP methods added ?
+
The implementation will leverage the ''read()''/''save()'' function that we currently used to read and write backups from storage.
Which routes were added/modified/extended?
 
How does the Request body look like?
 
How does the Response object look like?
 
 
 
===Internal API===
 
Does this change any internal messages between API and Task Manager or Task Manager to Guest
 
====RPC API description====
 
  
Method name.
 
Method parameters.
 
Message type (cast/call).
 
 
==Guest Agent==
 
==Guest Agent==
Does this change behavior on the Guest Agent? If so, is it backwards compatible with API and Task Manager?
+
No changed in the guestagent will be needed as the bulk of the work will be performed by the taskmanager

Latest revision as of 23:38, 23 April 2014

Description

This feature allows users to create a new backup from a different backup in a different region. The source backup must be stored in a globally accessible storage.

Justification/Benefits

By having this feature, the user can migrate backups from one region to another region. This will allow users to migrate their databases from one region to a different region by simply creating a backup, migrating it to another region and restoring it in that region.

Impacts

Configuration

Most of the configs needed would be credential to access the storage in the different region. If we use swift as the storage strategy and swift is accessible globally and cross-region, we can reuse the same credentials to verify accessibility.

We can also provide a flag to enable this feature. Although this might not be required as it may be handled by the new trove-capabilities feature.

Database

No schema change is required. This feature will simple create new records in the 'backups' table.

Public API

Currently, to create a backup, a POST is sent to /backups specifying the instance ID among other required fields. Trove then create a backup for that instance and stores it. With this feature, the backup is created by providing a backup reference that points to the location of the source backup instead of the instance ID. Trove will then fetch the source backup, creates a record and push the backup to its storage.

Here how the API would look: Request:

   {
       "backup":
       {
           "description": "Backup from a different region",
           "backup": {
               "region": "another-region",
               "id": "the-source-backup-id"
           },
           "instance": null,
           "name": "backup-from-different-region"
       }
   }

Response:

   {
       "backup":
       {
           "created": "2013-05-01T00:00:00",
           "description": "Backup from a different region",
           "id": "aeb6fa4c-932d-4acc-a339-cccfb9f300b2",
           "instance_id": null,
           "locationRef": "http://my-region.trove.com:8080/v1/tenant1/database_backups/aeb6fa4c-932d-4acc-a339-cccfb9f300b2.xbstream.gz.enc",
           "name": "backup-from-different-region",
           "status": "COMPLETED",
           "size": 2.0,
           "updated": "2013-05-01T00:00:00"
       }
   }

CLI interface

For CLI, there will be a backup-copy subcommand that will take params: 'name' and 'backup', which correspond to the name to be assigned to the new backup and the backup id of the source backup. Optionally, it will take a 'description' and a 'region'. The 'region' will allow you to copy backups from a different region.

Internal API

The create_backup RPC method in the taskmanager will be modified to take an optional backup_ref value. The taskmanager will use this reference to fetch the source backup from globally accessible storage (different region) and push it to the trove's storage.

The implementation will leverage the read()/save() function that we currently used to read and write backups from storage.

Guest Agent

No changed in the guestagent will be needed as the bulk of the work will be performed by the taskmanager