API |
描述 |
ModifyInstanceParam |
修改实例参数 |
CloseWanService |
关闭实例外网访问 |
OpenWanService |
开通实例外网访问 |
RestartDBInstances |
重启实例 |
OpenDBInstanceGTID |
开启实例的 GTID |
ModifyDBInstanceName |
修改云数据库实例名 |
ModifyDBInstanceProject |
修改云数据库实例的所属项目 |
ModifyDBInstanceVipVport |
修改云数据库实例的 IP 和端口号 |
DescribeDBInstanceCharset |
查询云数据库实例的字符集 |
DescribeDBInstanceConfig |
查询云数据库实例的配置信息 |
DescribeDBInstanceGTID |
查询云数据实例的 GTID 是否开通 |
DescribeDBInstanceRebootTime |
查询云数据库实例的预期重启时间 |
ModifyInstanceParam 修改实例参数
import logging
import traceback
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.ModifyInstanceParamRequest()
req.InstanceIds = ["cdb-1y6g3zj8","cdb-7ghaiocc"]
req.ParamList = [{"name":"max_connections","currentValue":"100"},{"name":"character_set_server","currentValue":"utf8"},{"name":"lower_case_table_names","currentValue":"1"}]
print req
resp = client.ModifyInstanceParam(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
msg = traceback.format_exc()
print (msg)
CloseWanService 关闭实例外网访问
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.CloseWanServiceRequest()
req.InstanceId = "cdb-1y6g3zj8"
resp = client.CloseWanService(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
OpenWanService 开通实例外网访问
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.OpenWanServiceRequest()
req.InstanceId = "cdb-1y6g3zj8"
resp = client.OpenWanService(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
RestartDBInstances 重启实例
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.RestartDBInstancesRequest()
req.InstanceIds = ["cdb-7ghaiocc"]
resp = client.RestartDBInstances(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
OpenDBInstanceGTID 开启实例的 GTID
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.OpenDBInstanceGTIDRequest()
req.InstanceId = "cdb-7ghaiocc"
resp = client.OpenDBInstanceGTID(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
ModifyDBInstanceName 修改云数据库实例名
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-beijing")
req = models.ModifyDBInstanceNameRequest()
req.InstanceId = "cdb-cukm86n2"
req.InstanceName = "1s中文"
resp = client.ModifyDBInstanceName(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
ModifyDBInstanceProject 修改云数据库实例的所属项目
import logging
import traceback
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
def DescribeDBInstancesList():
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.ModifyDBInstanceProjectRequest()
req.InstanceIds = ["cdb-7ghaiocc"]
req.NewProjectId =1
resp = client.ModifyDBInstanceProject(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
msg = traceback.format_exc()
print (msg)
DescribeDBInstancesList()
ModifyDBInstanceVipVport 修改云数据库实例的 IP 和端口号
import logging
import traceback
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.ModifyDBInstanceVipVportRequest()
req.InstanceId = "cdb-7ghaiocc"
req.DstIp = "10.0.0.13"
req.DstPort =1025
req.UniqVpcId = 1111
resp = client.ModifyDBInstanceVipVport(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
msg = traceback.format_exc()
print (msg)
DescribeDBInstanceCharset 查询云数据库实例的字符集
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.DescribeDBInstanceCharsetRequest()
req.InstanceId = "cdb-1y6g3zj8"
resp = client.DescribeDBInstanceCharset(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
DescribeDBInstanceConfig 查询云数据库实例的配置信息
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.DescribeDBInstanceConfigRequest()
req.InstanceId = "cdb-1y6g3zj8"
resp = client.DescribeDBInstanceConfig(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
DescribeDBInstanceGTID 查询云数据实例的 GTID 是否开通
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.DescribeDBInstanceGTIDRequest()
req.InstanceId = "cdb-1y6g3zj8"
resp = client.DescribeDBInstanceGTID(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
DescribeDBInstanceRebootTime 查询云数据库实例的预期重启时间
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models
try:
cred = credential.Credential("secretId", "secretKey")
client = cdb_client.CdbClient(cred, "ap-shanghai")
req = models.DescribeDBInstanceRebootTimeRequest()
req.InstanceIds = ["cdb-1y6g3zj8"]
resp = client.DescribeDBInstanceRebootTime(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
本页内容是否解决了您的问题?