ALIYUN::DTS::SynchronizationJob类型用于购买同步实例、配置同步作业。

语法

{
  "Type": "ALIYUN::DTS::SynchronizationJob",
  "Properties": {
    "SynchronizationJobClass": String,
    "SourceEndpoint": Map,
    "PayType": String,
    "DataInitialization": Boolean,
    "Period": String,
    "DestRegion": String,
    "SourceRegion": String,
    "UsedTime": Integer,
    "SynchronizationObjects": List,
    "NetworkType": String,
    "DestinationEndpoint": Map,
    "StructureInitialization": Boolean,
    "Topology": String
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
SynchronizationJobClass String 同步实例规格。 取值:
  • micro
  • small(默认值)
  • medium
  • large
SourceEndpoint Map 源实例配置。 详情请参见SourceEndpoint属性
PayType String 付费类型。 取值:
  • Postpaid:后付费。
  • Prepaid:预付费。
DataInitialization Boolean 同步之前是否进行全量数据初始化。 取值:
  • true(默认值)
  • false
Period String 预付费周期。 取值:
  • Year
  • Month
PayType取值为Prepaid时生效。
DestRegion String 目标实例所在的地域。
SourceRegion String 源实例所在的地域。
UsedTime Integer 预付费类型实例订购时长。 PayType取值为Prepaid时此参数生效。
SynchronizationObjects List 同步对象。 详情请参见SynchronizationObjects属性
NetworkType String 当进行跨地域同步时,使用的数据传输网络类型。 取值:
  • Internet(默认值)
  • Intranet
DestinationEndpoint Map 同步链路配置。 详情请参见DestinationEndpoint属性
StructureInitialization Boolean 同步之前是否进行结构对象初始化。 取值:
  • true(默认值)
  • false
Topology String 同步拓扑。 取值:
  • oneway(默认值)
  • bidirectional
只有MySQL之间的同步时,此参数才能取值bidirectional。

SourceEndpoint语法

"SourceEndpoint": {
  "UserName": String,
  "InstanceId": String,
  "IP": String,
  "Port": String,
  "Role": String,
  "OwnerID": String,
  "Password": String,
  "InstanceType": String,
  "InstanceTypeForCreation": String
}

SourceEndpoint属性

属性名称 类型 必须 允许更新 描述 约束
UserName String 源实例的访问账号。 当源实例为ECS或通过专线接入的本地数据库时,必须指定此参数。当源数据库为Redis时,无需指定此参数。
InstanceId String 源实例的ID。
IP String 源实例的IP地址。 当源实例为通过专线接入的本地数据库时,必须指定此参数。
Port String 源实例的监听端口。 当源实例为ECS或通过专线接入的本地数据库时,必须指定此参数。
Role String 当源实例与目标实例不属于同一个阿里云账号时,此参数为源实例所属账号对目标实例所属账号的授权角色。角色的相关权限及授权步骤,请参见DTS跨账号数据迁移或同步支持的实例类型
OwnerID String 当源实例与目标实例不属于同一个阿里云账号时,此参数为源实例所属阿里云账号的UID。
Password String 源实例的访问密码。 当源实例为ECS或通过专线接入的本地数据库时,必须指定此参数。
InstanceType String 源实例的类型。 取值:
  • Redis:阿里云Redis实例。
  • RDS:阿里云RDS实例。
  • POLARDB:阿里云PolarDB MySQL集群 。
  • ECS:ECS上的自建数据库。
  • Express:通过专线接入的自建数据库。
  • dg:通过数据库网关DG接入的自建数据库。
  • cen:通过云企业网CEN接入的自建数据库。
InstanceTypeForCreation String 同步链路的源实例类型。 取值:
  • MySQL
  • PolarDB
  • Redis
  • SQLServer
  • PostgreSQL
  • PolarDB-X(原DRDS升级版)

SynchronizationObjects 语法

"SynchronizationObjects": [
  {
    "TableExcludes": List,
    "NewSchemaName": String,
    "NewDBName": String,
    "TableIncludes": List,
    "SchemaName": String,
    "DBName": String
  }
]

SynchronizationObjects属性

属性名称 类型 必须 允许更新 描述 约束
TableExcludes List 待同步数据库不需要同步的表名。
NewSchemaName String 待同步Schema在目标实例中映射的Schema名。
NewDBName String 待同步数据库在目标实例中映射的库名。
TableIncludes List 待同步表。
SchemaName String 待同步Schema名。
DBName String 待同步数据库名。

TableExcludes语法

"TableExcludes": [
  {
    "TableName": String
  }
]

TableExcludes属性

属性名称 类型 必须 允许更新 描述 约束
TableName String 表名

TableIncludes语法

"TableIncludes": [
  {
    "TableName": String,
    "FilterCondition": String,
    "ColumnExcludes": List,
    "ColumnIncludes": List,
    "NewTableName": String
  }
]

TableIncludes属性

属性名称 类型 必须 允许更新 描述 约束
TableName String 待同步的表名。
FilterCondition String 过滤条件。
ColumnExcludes List 不同步的列。
ColumnIncludes List 需同步的列。
NewTableName String 待同步表在目标实例映射的表名。

ColumnExcludes语法

"ColumnExcludes": [
  {
    "ColumnName": String
  }
]

ColumnExcludes属性

属性名称 类型 必须 允许更新 描述 约束
ColumnName String 不同步的列名

ColumnIncludes语法

"ColumnIncludes": [
  {
    "NewColumnName": String,
    "ColumnName": String
  }
]

ColumnIncludes属性

属性名称 类型 必须 允许更新 描述 约束
NewColumnName String 待同步列在目标实例中映射的列名。
ColumnName String 需同步的列名。

DestinationEndpoint语法

"DestinationEndpoint": {
  "UserName": String,
  "InstanceId": String,
  "IP": String,
  "InstanceType": String,
  "Password": String,
  "InstanceTypeForCreation": String,
  "Port": String
}

DestinationEndpoint属性

属性名称 类型 必须 允许更新 描述 约束
UserName String 目标实例的访问账号。 当目标实例为ECS或通过专线接入的本地数据库时,必须指定此参数。当目标数据库为Redis时,无需指定此参数。
InstanceId String 目标实例的ID。
  • 当目标实例为MaxCompute时,指定MaxCompute实例中的Project名称。
  • 当目标实例为阿里云分析型数据库MySQL版时,指定分析型数据库MySQL版的集群ID。
  • 当目标实例为DataHub时,指定DataHub实例中的Project名称。
IP String 目标实例IP地址。 当目标实例为通过专线接入的本地数据库时,必须指定此参数。
InstanceType String 目标实例的类型。 取值:
  • Redis:阿里云Redis实例。
  • RDS(默认值):阿里云RDS实例。
  • POLARDB:阿里云PolarDB MySQL集群。
  • ECS:ECS上的自建数据库。
  • Express:通过专线接入的本地数据库。
  • MaxCompute:阿里云MaxCompute实例。
  • DataHub:阿里云DataHub实例。
  • AnalyticDB:阿里云分析型数据库MySQL版(2.0)。
  • AnalyticDB30:阿里云分析型数据库MySQL版(3.0)。
InstanceTypeForCreation String 同步链路的目标实例类型。 取值:
  • MySQL
  • PolarDB
  • Redis
  • MaxCompute
  • DataHub
  • Kafka
  • Elasticsearch
  • Tablestore
Password String 目标实例的访问密码。 当目标实例为ECS或通过专线接入的本地数据库时,必须指定此参数。
Port String 目标实例监听端口。 当目标实例为ECS或通过专线接入的本地数据库时,必须指定此参数。

返回值

Fn::GetAtt

SynchronizationJobId:同步实例ID。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SynchronizationObjects": {
      "Type": "Json",
      "Description": "Objects that need to be synchronized"
    },
    "Period": {
      "Type": "String",
      "Description": "If prepaid payment type, then the parameters specified in the purchase package instance or instances as examples of a monthly subscription, which can be:\nYear: Annual, Month: monthly",
      "AllowedValues": [
        "Year",
        "Month"
      ]
    },
    "PayType": {
      "Type": "String",
      "Description": "Payment type, which include:\nPostpaid: postpaid type, Prepaid: Prepaid type. Default is Postpaid",
      "AllowedValues": [
        "Postpaid",
        "Prepaid"
      ],
      "Default": "Postpaid"
    },
    "Topology": {
      "Type": "String",
      "Description": "Synchronous topology, the value includes: oneway, bidirectional.the default value is: oneway, only MySQL-> MySQL synchronization, this parameter can receive the value bidirectional"
    },
    "SourceRegion": {
      "Type": "String",
      "Description": "Region where the synchronization source instance is located."
    },
    "DataInitialization": {
      "Type": "Boolean",
      "Description": "Whether to perform full data initialization before synchronization. The values include:true: means full data initialization\nfalse: no full data initialization\nThe default value is: true",
      "AllowedValues": [
        "true",
        "false"
      ],
      "Default": true
    },
    "NetworkType": {
      "Type": "String",
      "Description": "When synchronization geographies, the type of data transmission network used. Value include: Internet, Intranet. The default value is: Internet",
      "AllowedValues": [
        "Internet",
        "Intranet"
      ]
    },
    "DestinationEndpoint": {
      "Type": "Json",
      "Description": "Migration target configuration"
    },
    "SourceEndpoint": {
      "Type": "Json",
      "Description": "Migration source configuration"
    },
    "UsedTime": {
      "Type": "Number",
      "Description": "f the payment type is prepaid, then this parameter is the length of the purchase, and parameters such as 1, 2, 3 can be passed in as needed"
    },
    "StructureInitialization": {
      "Type": "Boolean",
      "Description": "Whether to initialize the structure object before synchronization. The values include:true: indicates that the structure object is initialized\nfalse: no result object initialization\nThe default value is: true",
      "AllowedValues": [
        "true",
        "false"
      ],
      "Default": true
    },
    "SynchronizationJobClass": {
      "Type": "String",
      "Description": "Synchronous instance specifications, which can be:\nmicro, small, medium, large and so on. The default value is: small"
    },
    "DestRegion": {
      "Type": "String",
      "Description": "Region where the synchronization target instance is located."
    }
  },
  "Resources": {
    "SynchronizationJob": {
      "Type": "ALIYUN::DTS::SynchronizationJob",
      "Properties": {
        "SynchronizationObjects": {
          "Ref": "SynchronizationObjects"
        },
        "Period": {
          "Ref": "Period"
        },
        "PayType": {
          "Ref": "PayType"
        },
        "Topology": {
          "Ref": "Topology"
        },
        "SourceRegion": {
          "Ref": "SourceRegion"
        },
        "DataInitialization": {
          "Ref": "DataInitialization"
        },
        "NetworkType": {
          "Ref": "NetworkType"
        },
        "DestinationEndpoint": {
          "Ref": "DestinationEndpoint"
        },
        "SourceEndpoint": {
          "Ref": "SourceEndpoint"
        },
        "UsedTime": {
          "Ref": "UsedTime"
        },
        "StructureInitialization": {
          "Ref": "StructureInitialization"
        },
        "SynchronizationJobClass": {
          "Ref": "SynchronizationJobClass"
        },
        "DestRegion": {
          "Ref": "DestRegion"
        }
      }
    }
  },
  "Outputs": {
    "SynchronizationJobId": {
      "Description": "Synchronization instance ID",
      "Value": {
        "Fn::GetAtt": [
          "SynchronizationJob",
          "SynchronizationJobId"
        ]
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SynchronizationObjects:
    Type: Json
    Description: Objects that need to be synchronized
  Period:
    Type: String
    Description: >-
      If prepaid payment type, then the parameters specified in the purchase
      package instance or instances as examples of a monthly subscription, which
      can be:

      Year: Annual, Month: monthly
    AllowedValues:
      - Year
      - Month
  PayType:
    Type: String
    Description: |-
      Payment type, which include:
      Postpaid: postpaid type, Prepaid: Prepaid type. Default is Postpaid
    AllowedValues:
      - Postpaid
      - Prepaid
    Default: Postpaid
  Topology:
    Type: String
    Description: >-
      Synchronous topology, the value includes: oneway, bidirectional.the
      default value is: oneway, only MySQL-> MySQL synchronization, this
      parameter can receive the value bidirectional
  SourceRegion:
    Type: String
    Description: Region where the synchronization source instance is located.
  DataInitialization:
    Type: Boolean
    Description: >-
      Whether to perform full data initialization before synchronization. The
      values include:true: means full data initialization

      false: no full data initialization

      The default value is: true
    AllowedValues:
      - 'true'
      - 'false'
    Default: true
  NetworkType:
    Type: String
    Description: >-
      When synchronization geographies, the type of data transmission network
      used. Value include: Internet, Intranet. The default value is: Internet
    AllowedValues:
      - Internet
      - Intranet
  DestinationEndpoint:
    Type: Json
    Description: Migration target configuration
  SourceEndpoint:
    Type: Json
    Description: Migration source configuration
  UsedTime:
    Type: Number
    Description: >-
      f the payment type is prepaid, then this parameter is the length of the
      purchase, and parameters such as 1, 2, 3 can be passed in as needed
  StructureInitialization:
    Type: Boolean
    Description: >-
      Whether to initialize the structure object before synchronization. The
      values include:true: indicates that the structure object is initialized

      false: no result object initialization

      The default value is: true
    AllowedValues:
      - 'true'
      - 'false'
    Default: true
  SynchronizationJobClass:
    Type: String
    Description: |-
      Synchronous instance specifications, which can be:
      micro, small, medium, large and so on. The default value is: small
  DestRegion:
    Type: String
    Description: Region where the synchronization target instance is located.
Resources:
  SynchronizationJob:
    Type: 'ALIYUN::DTS::SynchronizationJob'
    Properties:
      SynchronizationObjects:
        Ref: SynchronizationObjects
      Period:
        Ref: Period
      PayType:
        Ref: PayType
      Topology:
        Ref: Topology
      SourceRegion:
        Ref: SourceRegion
      DataInitialization:
        Ref: DataInitialization
      NetworkType:
        Ref: NetworkType
      DestinationEndpoint:
        Ref: DestinationEndpoint
      SourceEndpoint:
        Ref: SourceEndpoint
      UsedTime:
        Ref: UsedTime
      StructureInitialization:
        Ref: StructureInitialization
      SynchronizationJobClass:
        Ref: SynchronizationJobClass
      DestRegion:
        Ref: DestRegion
Outputs:
  SynchronizationJobId:
    Description: Synchronization instance ID
    Value:
      'Fn::GetAtt':
        - SynchronizationJob
        - SynchronizationJobId