API | Description |
CreateBackup | Creates a TencentDB instance backup |
DeleteBackup | Deleting a TencentDB instance backup |
DescribeBackupConfig | This API shows you how to query the configuration information of a TencentDB instance backup. |
DescribeBackups | This example shows you how to query the list of data backup files. |
DescribeBinlogs | This example shows you how to query a binlog. |
DescribeSlowLogs | Querying slow logs |
ModifyBackupConfig | This example shows you how to modify the database backup configuration. |
CreateBackup: Creating a TencentDB instance backup
#!/usr/bin/python# -*- coding: utf-8 -*-# Introduce the Cloud API entry modulefrom tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:Instantiate an authentication object, passing in the Tencent Cloud account SecretId and SecretKey as parameterscred = credential.Credential("secretId", "secretKey")Instantiate a client object for the desired product (usingcdbas an example)client = cdb_client.CdbClient(cred, "ap-shanghai")Instantiate a request object: req = models.ModifyInstanceParamRequest()req = models.CreateBackupRequest()req.InstanceId = "cdb-7ghaiocc"req.BackupMethod = "logical"print reqInvoke the desired API through the client object by passing in the request objectresp = client.CreateBackup(req)Returns a JSON-formatted response stringprint(resp.to_json_string())except TencentCloudSDKException as err:print(err)
DeleteBackup: Deleting a TencentDB instance backup
#!/usr/bin/python# -*- coding: utf-8 -*-# Introduce the Cloud API entry modulefrom tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:Instantiate an authentication object, passing in the Tencent Cloud account SecretId and SecretKey as parameterscred = credential.Credential("secretId", "secretKey")Instantiate a client object for the desired product (usingcdbas an example)client = cdb_client.CdbClient(cred, "ap-shanghai")Instantiate a request object: req = models.ModifyInstanceParamRequest()req = models.DeleteBackupRequest()req.InstanceId = "cdb-7ghaiocc"#print req.BackupIdreq.BackupId = 105119782Invoke the desired API through the client object by passing in the request objectresp = client.DeleteBackup(req)Returns a JSON-formatted response stringprint(resp.to_json_string())except TencentCloudSDKException as err:print(err)
DescribeBackupConfig: Querying the configuration information of a TencentDB instance backup
#!/usr/bin/python# -*- coding: utf-8 -*-# Introduce the Cloud API entry modulefrom tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:Instantiate an authentication object, passing in the Tencent Cloud account SecretId and SecretKey as parameterscred = credential.Credential("secretId", "secretKey")Instantiate a client object for the desired product (usingcdbas an example)client = cdb_client.CdbClient(cred, "ap-shanghai")Instantiate a request object: req = models.ModifyInstanceParamRequest()req = models.DescribeBackupConfigRequest()req.InstanceId = "cdb-7ghaiocc"print reqInvoke the desired API through the client object by passing in the request objectresp = client.DescribeBackupConfig(req)Returns a JSON-formatted response stringprint(resp.to_json_string())except TencentCloudSDKException as err:print(err)
DescribeBackups: Query the list of data backup files
#!/usr/bin/python# -*- coding: utf-8 -*-# Introduce the Cloud API entry modulefrom tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:Instantiate an authentication object, passing in the Tencent Cloud account SecretId and SecretKey as parameterscred = credential.Credential("secretId", "secretKey")Instantiate a client object for the desired product (usingcdbas an example)client = cdb_client.CdbClient(cred, "ap-shanghai")Instantiate a request object: req = models.ModifyInstanceParamRequest()req = models.DescribeBackupsRequest()req.InstanceId = "cdb-7ghaiocc"Invoke the desired API through the client object by passing in the request objectresp = client.DescribeBackups(req)print respReturns a JSON-formatted response stringprint(resp.to_json_string())except TencentCloudSDKException as err:print(err)
DescribeBinlogs: Querying binary logs
#!/usr/bin/python# -*- coding: utf-8 -*-# Introduce the Cloud API entry modulefrom tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:Instantiate an authentication object, passing in the Tencent Cloud account SecretId and SecretKey as parameterscred = credential.Credential("secretId", "secretKey")Instantiate a client object for the desired product (usingcdbas an example)client = cdb_client.CdbClient(cred, "ap-shanghai")Instantiate a request object: req = models.ModifyInstanceParamRequest()req = models.DescribeBinlogsRequest()req.InstanceId = "cdb-7ghaiocc"Invoke the desired API through the client object by passing in the request objectresp = client.DescribeBinlogs(req)Returns a JSON-formatted response stringprint(resp.to_json_string())except TencentCloudSDKException as err:print(err)
DescribeSlowLogs: Querying slow query logs
#!/usr/bin/python# -*- coding: utf-8 -*-# Introduce the Cloud API entry modulefrom tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:Instantiate an authentication object, passing in the Tencent Cloud account SecretId and SecretKey as parameterscred = credential.Credential("secretId", "secretKey")Instantiate a client object for the desired product (usingcdbas an example)client = cdb_client.CdbClient(cred, "ap-shanghai")Instantiate a request object: req = models.ModifyInstanceParamRequest()req = models.DescribeSlowLogsRequest()req.InstanceId = "cdb-7ghaiocc"Invoke the desired API through the client object by passing in the request objectresp = client.DescribeSlowLogs(req)Returns a JSON-formatted response stringprint(resp.to_json_string())except TencentCloudSDKException as err:print(err)
ModifyBackupConfig: Modify the TencentDB instance backup configuration
#!/usr/bin/python# -*- coding: utf-8 -*-# Introduce the Cloud API entry modulefrom tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:Instantiate an authentication object, passing in the Tencent Cloud account SecretId and SecretKey as parameterscred = credential.Credential("secretId", "secretKey")Instantiate a client object for the desired product (usingcdbas an example)client = cdb_client.CdbClient(cred, "ap-shanghai")Instantiate a request object: req = models.ModifyInstanceParamRequest()req = models.ModifyBackupConfigRequest()req.InstanceId = "cdb-1y6g3zj8"req.ExpireDays = 10req.StartTime = "06:00-10:00"req.BackupMethod = "logical"print reqInvoke the desired API through the client object by passing in the request objectresp = client.ModifyBackupConfig(req)Returns a JSON-formatted response stringprint(resp.to_json_string())except TencentCloudSDKException as err:print(err)