7 Backup APIs

Backup APIs can be used to create On-demand Database backups and check status of On-demand backups in cnDBTier. These APIs are hosted by the DB backup manager service.

Note:

The "base-uri" will be "<db-backup-manager-svc svc>: 8085".

Example:

# Get the db-backup-manager-svc pod name from cnDBTier cluster.
$ kubectl -n <namespace of cnDBTier cluster> get pods -l dbtierapp=dbbackupmanagersvc --no-headers | awk  '{print $1}'

 
# Get the db-backup-manager-svc svc name from cnDBTier cluster.
$ kubectl -n <namespace of cnDBTier cluster> get svc -l dbtierapp=dbbackupmanagersvc --no-headers | awk  '{print $1}'
 
# Login to the db-backup-manager-svc pod and use below REST API for creating the on-demand backup.
$ kubectl -n <namespace of cnDBTier cluster> exec -it <db-backup-manager-svc pod> -- bash
$ curl -i -X POST http://<db-backup-manager-svc svc>:8085/db-tier/on-demand/backup/initiate
$ curl -i -X GET http://<db-backup-manager-svc svc>:8085/db-tier/on-demand/backup/<BACKUP_ID_INITIATED>/status

7.1 Site Specific On-demand Backup Creation API

This API initiates an on-demand database backup for a specific cnDBTier site or cluster by using the cnDBTier backup manager service.

API Definition

URI: http://base-uri/db-tier/on-demand/backup/initiate

Method: POST

API Type: Realtime API

Request Payload Response Code Response Payload
NA 200 OK - Successfully started the On Demand backup
{

  "backup_id":"<Backup id>",

  "status":"<Backup Initiation Status>"

  "backup_encryption_flag": "<backup encryption enabled/disabled>"

}
500 INTERNAL SERVER ERROR - Could not initiate On-demand Backup
{

  "error_type":"<error type>",

  "error_message":"<error message>"

}
400 BAD REQUEST request is invalid
{

  "error_type":"<error type>",

  "error_message":"<error message>"

}
503 SERVICE UNAVAILABLE data node is down
{

  "error_type":"<error type>",

  "error_message":"<error message>"

}
409 CONFLICT backup is already going on
{

  "error_type":"<error type>",

  "error_message":"<error message>"

}

API Configuration

Field Description Details
backup_id This attribute displays the ID of the stored backup.

DataType: string

Constraints: NA

Default Value: NA

status This attribute displays the status of the backup operation.

DataType: String

Constraints: BACKUP_INITIATED, BACKUP_INITIATION_FAILED

Default Value: NA

backup_encryption_flag This attribute indicates whether backup encryption has been enabled or not.

DataType: String

Constraints: true, false

Default Value: NA

7.2 Site Specific On-demand Backup Status API

This API retrieves the current status of an on-demand backup operation for a specific cnDBTier site.

API Definition

URI: http://base-uri/db-tier/on-demand/backup/<BACKUP_ID_INITIATED>/status

Method: GET

API Type: Realtime API

Request Payload Response Code Response Payload
NA 200 OK
If .Values.global.remotetransfer.enable is true then the response will be
{
  "backup_status":"<Backup status>",
  "transfer_status":"<Transfer Status>"
}

Note: Here the transfer_status indicates the backup transfer status from db-backup-manager-svc to db-replication-svc not to the remote server.

If .Values.global.remotetransfer.enable is false then the response will be
{
   "status": "<Backup status>"
}
500 INTERNAL SERVER ERROR - Could not check status for the specified On-demand Backup ID
{
  "error_type":"<error type>",
  "error_message":"<error message>"
}
400 BAD REQUEST Request is invalid
{
  "error_description": "<error_description>",
  "error_type": "<error type>"
}
404 NOT FOUND backup_id does not exist
{
  "error_description": "<error_description>",
  "error_type": "<error type>"
}

API Configuration

Field Description Details
backup_status This attribute displays the status of the backup operation.

DataType: string

Constraints: STARTED, FAILED, COMPLETED, PURGED, PURGED_EARLY

Default Value: NA

transfer_status This attribute displays the status of the backup transfer from db-backup-manager-svc to db-replication-svc.

Note: This attribute is displayed only when remote transfer is enabled.

DataType: string

Constraints: REQUESTED, INPROGRESS, FAILED, COMPLETED

Default Value: NA

7.3 Health Check API

This API verifies whether the local cnDBTier or NDB cluster is available and healthy.

API Definition

URI: http://base-uri/db-tier/health

Method: GET

API Type: Realtime API

Request Payload Response Code Response Payload
NA 200 OK
{

    "is_connected_to_db": "<true|false>", 

    "overall_status": "<true|false>",

    "service_name": "<mysql-cluster-db-backup-manager-svc>"

    "executor_status_list": 

    [

        {

            "_node_id": "<node_id>",

            "_is_connected_to_db": "<true|false>",

            "_is_running": "<true|false>"

        },

        ...

    ]

}
500 INTERNAL SERVER ERROR
{
  "error_type":"<error type>",
  "error_message":"<error message>"
}

API Configuration

Field Description Details
is_connected_to_db This attribute displays the status of the database connection.

DataType: Boolean

Constraints: true, false

Default Value: NA

overall_status This attribute displays the operational well-being of the backup executor service.

DataType: Boolean

Constraints: true, false

Default Value: NA

service_name This attribute displays the name of the cnDBTier microservice.

DataType: String

Constraints: NA

Default Value: NA

executor_status_list This attribute displays the following information like backup upload status, database connection, overall status, and service name.

DataType: List

Constraints: NA

Default Value: NA

_node_id This attribute displays the Node ID of the DB node.

DataType: Integer

Constraints: NA

Default Value: NA

_backup_upload_status This attribute displays the following information like backup ID, description, local file path, node ID, remote file path, SFTP hostname, transfer state, and upload percentage.

DataType: Object

Constraints: NA

Default Value: NA

backup_id This attribute displays the ID of the stored backup.

DataType: String

Constraints: NA

Default Value: NA

node_id This attribute displays the Node ID of the DB node.

DataType: String

Constraints: NA

Default Value: NA

sftp_hostname This attribute displays the hostname for SFTP.

DataType: String

Constraints: NA

Default Value: NA

local_file_path This attribute displays the path of the backup file within the local microservice.

DataType: String

Constraints: NA

Default Value: NA

remote_file_path This attribute displays the path of the backup file within the remote microservice.

DataType: String

Constraints: NA

Default Value: NA

upload_percentage This attribute indicates the percentage of the backup transfer that has been uploaded.

DataType: Integer

Constraints: NA

Default Value: NA

transfer_state This attribute displays the state of the backup transfer.

DataType: String

Constraints: NOT_STARTED, REQUESTED, INPROGRESS, COMPLETED, FAILED

Default Value: NA

description This attribute displays the description of the backup transfer.

DataType: String

Constraints: NA

Default Value: NA