Recover Database from Backup
Recover database backup from backup storage.
Headers
Authorization: OAuth the-session-uuidBody
{
"recoverDatabaseFromBackup": {
"backupStorageUrl": "ssh://root:password@localhost:22/Cloud_bs",
"backupInstallPath": "zstore://zsbak/0ed599ec519249489475112a058bb93a",
"mysqlRootPassword": "password"
},
"systemTags": [],
"userTags": []
}The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"recoverDatabaseFromBackup":{"backupStorageUrl":"ssh://root:password@localhost:22/Cloud_bs","backupInstallPath":"zstore://zsbak/0ed599ec519249489475112a058bb93a","mysqlRootPassword":"password"}}' http://localhost:8080/zstack/v1/database-backups/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid (Optional) | String | url | The UUID of the resource. Uniquely identifies the resource | 3.0.0 | |
| backupStorageUrl (Optional) | String | body (Contained in the recoverDatabaseFromBackup structure) | Image Storage URL | 3.0.0 | |
| backupInstallPath (Optional) | String | body (Contained in the recoverDatabaseFromBackup structure) | Database backup storage path | 3.0.0 | |
| mysqlRootPassword | String | body (Contained in the recoverDatabaseFromBackup structure) | MySQL database ROOT password | 3.0.0 | |
| systemTags (Optional) | List | body | 3.0.0 | ||
| userTags (Optional) | List | body | 3.0.0 |
API Response
Response Example
{
"logListenPort": 0.0
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| logListenPort | int | Browsers can use this port number to print logs in real time | 3.0.0 |
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. For details, see error | 3.0.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 3.0.0 |
| description | String | A brief description of the error | 3.0.0 |
| details | String | The detailed error information | 3.0.0 |
| elaboration | String | Reserved field. Default is null | 3.0.0 |
| opaque | LinkedHashMap | Reserved field. Default is null | 3.0.0 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error | 3.0.0 |
SDK Examples
Java SDK
RecoverDatabaseFromBackupAction action = new RecoverDatabaseFromBackupAction();
action.backupStorageUrl = "ssh://root:password@localhost:22/Cloud_bs";
action.backupInstallPath = "zstore://zsbak/0ed599ec519249489475112a058bb93a";
action.mysqlRootPassword = "password";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RecoverDatabaseFromBackupAction.Result res = action.call();Python SDK
RecoverDatabaseFromBackupAction action = RecoverDatabaseFromBackupAction()
action.backupStorageUrl = "ssh://root:password@localhost:22/Cloud_bs"
action.backupInstallPath = "zstore://zsbak/0ed599ec519249489475112a058bb93a"
action.mysqlRootPassword = "password"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RecoverDatabaseFromBackupAction.Result res = action.call()