API | 描述 |
CreateBackup | 创建云数据库备份 |
DeleteBackup | 删除云数据库备份 |
DescribeBackupConfig | 查询云数据库备份配置信息 |
DescribeBackups | 查询数据备份文件列表 |
DescribeBinlogs | 查询二进制日志 |
DescribeSlowLogs | 查询慢查询日志 |
ModifyBackupConfig | 修改数据库备份配置 |
CreateBackup 创建云数据库备份
#!/usr/bin/python# -*- coding: utf-8 -*-# 引入云API入口模块from tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:# 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKeycred = credential.Credential("secretId", "secretKey")#实例化要请求产品(以cdb为例)的client对象client = cdb_client.CdbClient(cred, "ap-shanghai")#实例化一个请求对象:req = models.ModifyInstanceParamRequest()req = models.CreateBackupRequest()req.InstanceId = "cdb-7ghaiocc"req.BackupMethod = "logical"print req# 通过client对象调用想要访问的接口,需要传入请求对象resp = client.CreateBackup(req)# 输出json格式的字符串回包print(resp.to_json_string())except TencentCloudSDKException as err:print(err)
DeleteBackup 删除云数据库备份
#!/usr/bin/python# -*- coding: utf-8 -*-# 引入云API入口模块from tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:# 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKeycred = credential.Credential("secretId", "secretKey")#实例化要请求产品(以cdb为例)的client对象client = cdb_client.CdbClient(cred, "ap-shanghai")#实例化一个请求对象:req = models.ModifyInstanceParamRequest()req = models.DeleteBackupRequest()req.InstanceId = "cdb-7ghaiocc"#print req.BackupIdreq.BackupId = 105119782# 通过client对象调用想要访问的接口,需要传入请求对象resp = client.DeleteBackup(req)# 输出json格式的字符串回包print(resp.to_json_string())except TencentCloudSDKException as err:print(err)
DescribeBackupConfig 查询云数据库备份配置信息
#!/usr/bin/python# -*- coding: utf-8 -*-# 引入云API入口模块from tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:# 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKeycred = credential.Credential("secretId", "secretKey")#实例化要请求产品(以cdb为例)的client对象client = cdb_client.CdbClient(cred, "ap-shanghai")#实例化一个请求对象:req = models.ModifyInstanceParamRequest()req = models.DescribeBackupConfigRequest()req.InstanceId = "cdb-7ghaiocc"print req# 通过client对象调用想要访问的接口,需要传入请求对象resp = client.DescribeBackupConfig(req)# 输出json格式的字符串回包print(resp.to_json_string())except TencentCloudSDKException as err:print(err)
DescribeBackups 查询数据备份文件列表
#!/usr/bin/python# -*- coding: utf-8 -*-# 引入云API入口模块from tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:# 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKeycred = credential.Credential("secretId", "secretKey")#实例化要请求产品(以cdb为例)的client对象client = cdb_client.CdbClient(cred, "ap-shanghai")#实例化一个请求对象:req = models.ModifyInstanceParamRequest()req = models.DescribeBackupsRequest()req.InstanceId = "cdb-7ghaiocc"# 通过client对象调用想要访问的接口,需要传入请求对象resp = client.DescribeBackups(req)print resp# 输出json格式的字符串回包print(resp.to_json_string())except TencentCloudSDKException as err:print(err)
DescribeBinlogs 查询二进制日志
#!/usr/bin/python# -*- coding: utf-8 -*-# 引入云API入口模块from tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:# 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKeycred = credential.Credential("secretId", "secretKey")#实例化要请求产品(以cdb为例)的client对象client = cdb_client.CdbClient(cred, "ap-shanghai")#实例化一个请求对象:req = models.ModifyInstanceParamRequest()req = models.DescribeBinlogsRequest()req.InstanceId = "cdb-7ghaiocc"# 通过client对象调用想要访问的接口,需要传入请求对象resp = client.DescribeBinlogs(req)# 输出json格式的字符串回包print(resp.to_json_string())except TencentCloudSDKException as err:print(err)
DescribeSlowLogs 查询慢查询日志
#!/usr/bin/python# -*- coding: utf-8 -*-# 引入云API入口模块from tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:# 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKeycred = credential.Credential("secretId", "secretKey")#实例化要请求产品(以cdb为例)的client对象client = cdb_client.CdbClient(cred, "ap-shanghai")#实例化一个请求对象:req = models.ModifyInstanceParamRequest()req = models.DescribeSlowLogsRequest()req.InstanceId = "cdb-7ghaiocc"# 通过client对象调用想要访问的接口,需要传入请求对象resp = client.DescribeSlowLogs(req)# 输出json格式的字符串回包print(resp.to_json_string())except TencentCloudSDKException as err:print(err)
ModifyBackupConfig 修改数据库备份配置
#!/usr/bin/python# -*- coding: utf-8 -*-# 引入云API入口模块from tencentcloud.common import credentialfrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.cdb.v20170320 import cdb_client, modelstry:# 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKeycred = credential.Credential("secretId", "secretKey")#实例化要请求产品(以cdb为例)的client对象client = cdb_client.CdbClient(cred, "ap-shanghai")#实例化一个请求对象:req = models.ModifyInstanceParamRequest()req = models.ModifyBackupConfigRequest()req.InstanceId = "cdb-1y6g3zj8"req.ExpireDays = 10req.StartTime = "06:00-10:00"req.BackupMethod = "logical"print req# 通过client对象调用想要访问的接口,需要传入请求对象resp = client.ModifyBackupConfig(req)# 输出json格式的字符串回包print(resp.to_json_string())except TencentCloudSDKException as err:print(err)