tencent cloud

All product documents
TencentDB for MySQL
Backup Task
Last updated: 2023-09-13 15:56:15
Backup Task
Last updated: 2023-09-13 15:56:15
APIs
Description
CreateBackup
Creates a TencentDB instance backup
DeleteBackup
Deletes a TencentDB instance backup
DescribeBackupConfig
Queries the configuration information of a TencentDB instance backup
DescribeBackups
Queries the list of data backup files
DescribeBinlogs
Queries binary logs
DescribeSlowLogs
Queries slow logs
ModifyBackupConfig
Modifies the database backup configuration

CreateBackup for Creating a TencentDB Instance Backup

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The Tencent Cloud account `secretId` and `secretKey` need to be passed in as the input parameters
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object to request the product (with TencentDB as 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 req
# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.CreateBackup(req)

# The output is a string return packet in JSON format
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)

DeleteBackup for Deleting a TencentDB Instance Backup

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The Tencent Cloud account `secretId` and `secretKey` need to be passed in as the input parameters
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object to request the product (with TencentDB as 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.BackupId
req.BackupId = 105119782


# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.DeleteBackup(req)

# The output is a string return packet in JSON format
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)

DescribeBackupConfig for Querying the Configuration Information of a TencentDB Instance Backup

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The Tencent Cloud account `secretId` and `secretKey` need to be passed in as the input parameters
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object to request the product (with TencentDB as an example)
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.DescribeBackupConfigRequest()
req.InstanceId = "cdb-7ghaiocc"

print req
# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.DescribeBackupConfig(req)

# The output is a string return packet in JSON format
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)

DescribeBackupDatabases for Querying the list of data backup files

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The Tencent Cloud account `secretId` and `secretKey` need to be passed in as the input parameters
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object to request the product (with TencentDB as an example)
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.DescribeBackupsRequest()
req.InstanceId = "cdb-7ghaiocc"



# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.DescribeBackups(req)
print resp

# The output is a string return packet in JSON format
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)

DescribeBinlogs for Querying Binary Logs

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The Tencent Cloud account `secretId` and `secretKey` need to be passed in as the input parameters
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object to request the product (with TencentDB as an example)
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.DescribeBinlogsRequest()
req.InstanceId = "cdb-7ghaiocc"


# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.DescribeBinlogs(req)

# The output is a string return packet in JSON format
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)


DescribeSlowLogs for Querying Slow Logs

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The Tencent Cloud account `secretId` and `secretKey` need to be passed in as the input parameters
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object to request the product (with TencentDB as an example)
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.DescribeSlowLogsRequest()
req.InstanceId = "cdb-7ghaiocc"


# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.DescribeSlowLogs(req)

# The output is a string return packet in JSON format
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)


ModifyBackupConfig for Modifying the Database Backup Configuration

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The Tencent Cloud account `secretId` and `secretKey` need to be passed in as the input parameters
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object to request the product (with TencentDB as 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 = 10
req.StartTime = "06:00-10:00"
req.BackupMethod = "logical"
print req


# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.ModifyBackupConfig(req)

# The output is a string return packet in JSON format
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support