Le type ALIYUN::REDIS::Instance permet de créer des instances Redis.
Syntaxe
{
"Type": "ALIYUN::REDIS::Instance",
"Properties": {
"VpcId": String,
"EvictionPolicy": String,
"BackupPolicy": Map,
"ZoneId": String,
"InstanceClass": String,
"InstanceMaintainTime": Map,
"Tags": List,
"VpcPasswordFree": Boolean,
"VSwitchId": String,
"SecurityGroupId": String,
"EngineVersion": String,
"SSLEnabled": String,
"Password": String,
"InstanceName": String,
"DeletionForce": Boolean,
"Connections": Map,
"ChargeType": String,
"TLSProtocol": String,
"Period": Integer,
"AutoRenewDuration": Integer,
"ProductType": String,
"SubscriptionDeletionForce": Boolean,
"SecondaryZoneId": String,
"ResourceGroupId": String,
"PeriodUnit": String,
"TairConfig": Map,
"ShardCount": Integer,
"NodeType": String,
"DeletionProtection": Boolean,
"ReadOnlyCount": Integer
}
}
Propriétés
|
Propriété |
Type |
Obligatoire |
Modifiable |
Description |
Contraintes |
|
AutoRenewDuration |
Integer |
Non |
Oui |
Durée du renouvellement automatique. |
Valeurs valides : 1 à 12. Unité : mois. Lorsque l'instance est sur le point d'expirer, elle se renouvelle automatiquement pour la durée spécifiée par ce paramètre. Remarque
Ce paramètre est valide lorsque ChargeType est défini sur PrePaid. |
|
BackupPolicy |
Map |
Non |
Oui |
Politique de sauvegarde. |
Pour plus d'informations, consultez Propriétés de BackupPolicy. |
|
ChargeType |
String |
Non |
Oui |
Méthode de facturation de l'instance. |
Valeurs valides :
|
|
Connections |
Map |
Non |
Oui |
Adresse de connexion. |
Pour plus d'informations, consultez Propriétés de Connections. |
|
DeletionForce |
Boolean |
Non |
Oui |
Supprimez l'instance lors de la récupération. |
Valeurs valides :
|
|
DeletionProtection |
Boolean |
Non |
Oui |
Indique si la protection contre la libération est activée. |
Valeurs valides :
|
|
EngineVersion |
String |
Non |
Oui |
Version du moteur de base de données. |
Valeurs valides :
|
|
EvictionPolicy |
String |
Non |
Non |
Politique d'éviction des données. |
Valeurs valides :
|
|
InstanceClass |
String |
Non |
Oui |
Type d'instance. |
Pour plus d'informations, consultez Aperçu des spécifications des instances. |
|
InstanceMaintainTime |
Map |
Non |
Oui |
Fenêtre de maintenance de l'instance. |
Pour plus d'informations, consultez Propriétés de InstanceMaintainTime. |
|
InstanceName |
String |
Non |
Oui |
Nom de l'instance. |
Le nom de l'instance doit comporter entre 2 et 128 caractères. Il doit commencer par une lettre ou un caractère chinois et peut contenir des lettres, des chiffres, des caractères chinois, des traits de soulignement (_), des tirets (-) et des points (.). |
|
NodeType |
String |
Non |
Non |
Type de nœud. |
Valeurs valides :
Remarque
Pour les instances cloud-native, sélectionnez MASTER_SLAVE ou STAND_ALONE. Pour les instances classiques, sélectionnez double ou single. |
|
Password |
String |
Non |
Oui |
Mot de passe. |
Le mot de passe doit comporter entre 8 et 30 caractères et contenir des majuscules, des minuscules et des chiffres. |
|
Period |
Integer |
Non |
Oui |
Cycle de facturation. |
Valeurs valides : 1 à 9, 12, 24, 36, 60. Unité : mois. |
|
PeriodUnit |
String |
Non |
Oui |
Unité de durée. |
Valeurs valides :
|
|
ProductType |
String |
Non |
Non |
Type de produit. |
Valeurs valides :
Remarque
Définissez la propriété ProductType pour accélérer les requêtes de paramètres. |
|
ReadOnlyCount |
Integer |
Non |
Non |
Nombre de nœuds en lecture seule dans la zone principale. |
Remarque
Le paramètre ReadOnlyCount s'applique uniquement aux instances cloud-native avec activation de la séparation lecture/écriture. Si l'instance utilise une architecture en cluster, ce paramètre indique le nombre de nœuds en lecture seule (dans les zones principales et secondaires) pour un shard unique. |
|
ResourceGroupId |
String |
Non |
Oui |
ID du groupe de ressources. |
Aucune |
|
SecondaryZoneId |
String |
Non |
Oui |
ID de la zone secondaire. |
Vous pouvez appeler l'opération DescribeZones - Interroger les zones prises en charge. Remarque
Ce paramètre répartit les nœuds de données principaux et secondaires sur différentes zones, permettant une reprise après sinistre interzones et tolérant les pannes au niveau du centre de données. |
|
SecurityGroupId |
String |
Non |
Oui |
ID du groupe de sécurité. |
Définissez un maximum de 10 ID. Séparez les ID par des virgules (,). |
|
ShardCount |
Integer |
Non |
Non |
Nombre de shards. |
Ce paramètre s'applique uniquement aux instances à architecture en cluster basées sur disque. Utilisez ce paramètre pour personnaliser le nombre de shards. |
|
SSLEnabled |
String |
Non |
Oui |
Statut SSL. |
Valeurs valides :
|
|
SubscriptionDeletionForce |
Boolean |
Non |
Non |
Cette option s'applique uniquement aux instances par abonnement. Pour les instances par abonnement, si cette option est vraie, l'instance est convertie en instance de paiement à l'utilisation avant la suppression. Si elle est fausse, le système ne force pas la suppression. Cette opération entraîne des frais supplémentaires. Choisissez avec précaution. |
Aucune |
|
Tags |
List |
Non |
Oui |
Tags. |
Chaque instance prend en charge un maximum de 20 tags. Pour plus d'informations, consultez Propriétés de Tags. |
|
TairConfig |
Map |
Non |
Non |
Configuration Tair. |
Pour plus d'informations, consultez Propriétés de TairConfig. |
|
TLSProtocol |
String |
Non |
Non |
Version TLS de l'instance. |
Valeurs valides :
|
|
VpcId |
String |
Non |
Non |
ID du VPC. |
Aucune |
|
VpcPasswordFree |
Boolean |
Non |
Non |
Activez ou désactivez l'accès sans mot de passe aux instances dans un VPC. |
Valeurs valides :
|
|
VSwitchId |
String |
Non |
Non |
ID du vSwitch dans le VPC. |
Aucune |
|
ZoneId |
String |
Non |
Non |
ID de la zone. |
Ce paramètre est obligatoire lors de la création d'une instance dans un VPC. Lorsque vous créez une instance multizone, vous pouvez appeler l'opération API DescribeZones pour obtenir les ID multizones pris en charge. |
Syntaxe de BackupPolicy
"BackupPolicy": {
"PreferredBackupPeriod": "String",
"PreferredBackupTime": "String",
"EnableBackupLog": "Integer"
}
Propriétés de BackupPolicy
|
Propriété |
Type |
Obligatoire |
Modifiable |
Description |
Contraintes |
|
PreferredBackupPeriod |
String |
Oui |
Oui |
Cycle de sauvegarde. |
Valeurs valides :
|
|
PreferredBackupTime |
String |
Oui |
Oui |
Heure de sauvegarde. |
Format : |
|
EnableBackupLog |
Integer |
Non |
Oui |
Activez ou désactivez la sauvegarde incrémentielle. |
Valeurs valides :
|
Syntaxe de InstanceMaintainTime
"InstanceMaintainTime": {
"MaintainStartTime": "String",
"MaintainEndTime": "String"
}
Propriétés de InstanceMaintainTime
|
Propriété |
Type |
Obligatoire |
Modifiable |
Description |
Contraintes |
|
MaintainEndTime |
String |
Non |
Non |
Heure de fin de la fenêtre de maintenance. |
Format : Remarque
L'intervalle entre l'heure de début et l'heure de fin doit être d'une heure. Par exemple, si MaintainStartTime est |
|
MaintainStartTime |
String |
Non |
Non |
Heure de début de la fenêtre de maintenance. |
Format : |
Syntaxe de Tags
"Tags": [
{
"Key": String,
"Value": String
}
]
Propriétés de Tags
|**Propriété**
|
**Type**
|
**Obligatoire**
|
**Modifiable**
|
**Description**
|
**Contraintes**
| | --- | --- | --- | --- | --- | --- | |
Key
|
String
|
Oui
|
Non
|
Clé du tag.
|
La clé du tag doit être unique au sein du même compte et de la même région.
| |
Value
|
String
|
Non
|
Non
|
Valeur du tag.
|
Aucune
|
Syntaxe de Connections
"Connections": {
"VpcPrivateConnection": "Map",
"ClassicInnerConnection": "Map",
"DirectConnection": "Map",
"PublicConnection": "Map"
}
Propriétés de Connections
|**Propriété**
|
**Type**
|
**Obligatoire**
|
**Modifiable**
|
**Description**
|
**Contraintes**
| | --- | --- | --- | --- | --- | --- | |
ClassicInnerConnection
|
Map
|
Non
|
Oui
|
Adresse réseau interne classique.
|
Pour plus d'informations, consultez [Propriétés de ClassicInnerConnection](#section_cbe_qkl_0fb).
| |
DirectConnection
|
Map
|
Non
|
Oui
|
Adresse de connexion directe. Il s'agit d'une instance en cluster. Demandez les points de terminaison de connexion directe selon vos besoins.
|
Pour plus d'informations, consultez [Propriétés de DirectConnection](#section_4ze_mbp_ma8).
| |
PublicConnection
|
Map
|
Non
|
Oui
|
Adresse publique.
|
Pour plus d'informations, consultez [Propriétés de PublicConnection](#section_7ax_jed_23t).
| |
VpcPrivateConnection
|
Map
|
Non
|
Oui
|
Adresse réseau privée VPC.
|
Pour plus d'informations, consultez [Propriétés de VpcPrivateConnection](#section_0ul_zyf_sk9).
|
Syntaxe de VpcPrivateConnection
"VpcPrivateConnection": {
"ConnectionPort": Integer,
"ConnectionString": String
}
Propriétés de VpcPrivateConnection
|**Propriété**
|
**Type**
|
**Obligatoire**
|
**Modifiable**
|
**Description**
|
**Contraintes**
| | --- | --- | --- | --- | --- | --- | |
ConnectionPort
|
Integer
|
Oui
|
Oui
|
Port du service ApsaraDB de l'instance.
|
Valeurs valides : 1024 à 65535.
| |
ConnectionString
|
String
|
Non
|
Oui
|
Préfixe du point de terminaison public.
|
Le préfixe doit comporter entre 8 et 64 caractères, commencer par une lettre minuscule et contenir uniquement des lettres minuscules et des chiffres.
|
Syntaxe de PublicConnection
"PublicConnection": {
"ConnectionPort": Integer,
"ConnectionString": String
}
Propriétés de PublicConnection
|**Propriété**
|
**Type**
|
**Obligatoire**
|
**Modifiable**
|
**Description**
|
**Contraintes**
| | --- | --- | --- | --- | --- | --- | |
ConnectionPort
|
Integer
|
Oui
|
Oui
|
Port du service ApsaraDB de l'instance.
|
Valeurs valides : 1024 à 65535.
| |
ConnectionString
|
String
|
Non
|
Oui
|
Préfixe du point de terminaison public.
|
Le préfixe doit comporter entre 8 et 64 caractères, commencer par une lettre minuscule et contenir uniquement des lettres minuscules et des chiffres.
|
Syntaxe de DirectConnection
"DirectConnection": {
"ConnectionPort": Integer,
"ConnectionString": String
}
Propriétés de DirectConnection
|**Propriété**
|
**Type**
|
**Obligatoire**
|
**Modifiable**
|
**Description**
|
**Contraintes**
| | --- | --- | --- | --- | --- | --- | |
ConnectionPort
|
Integer
|
Oui
|
Oui
|
Port du service ApsaraDB de l'instance.
|
Valeurs valides : 1024 à 65535.
| |
ConnectionString
|
String
|
Non
|
Oui
|
Préfixe du point de terminaison public.
|
Le préfixe doit comporter entre 8 et 64 caractères, commencer par une lettre minuscule et contenir uniquement des lettres minuscules et des chiffres.
|
Syntaxe de ClassicInnerConnection
"ClassicInnerConnection": {
"ConnectionPort": Integer,
"ConnectionString": String
}
Propriétés de ClassicInnerConnection
|**Propriété**
|
**Type**
|
**Obligatoire**
|
**Modifiable**
|
**Description**
|
**Contraintes**
| | --- | --- | --- | --- | --- | --- | |
ConnectionPort
|
Integer
|
Oui
|
Oui
|
Port du service ApsaraDB de l'instance.
|
Valeurs valides : 1024 à 65535.
| |
ConnectionString
|
String
|
Non
|
Oui
|
Préfixe du point de terminaison public.
|
Le préfixe doit comporter entre 8 et 64 caractères, commencer par une lettre minuscule et contenir uniquement des lettres minuscules et des chiffres.
|
Syntaxe de TairConfig
"TairConfig": {
"Storage": "Integer",
"StorageType": "String",
"ShardCount": "Integer"
}
Propriétés de TairConfig
|
Propriété |
Type |
Obligatoire |
Modifiable |
Description |
Contraintes |
|
ShardCount |
Integer |
Non |
Non |
Nombre de nœuds de données dans l'instance. |
Valeurs valides :
|
|
Storage |
Integer |
Non |
Non |
Capacité de stockage du disque cloud. |
La capacité de stockage varie en fonction des spécifications de l'instance. Pour plus d'informations, consultez Instances basées sur ESSD/SSD. |
|
StorageType |
String |
Non |
Non |
Classe de stockage. |
Valeurs valides :
|
Valeurs de retour
Fn::GetAtt
InstanceId : ID de l'instance.
OrderId : ID de commande de l'instance.
ConnectionDomain : Adresse de connexion privée de l'instance.
Port : Port du service Redis.
InstanceName : Nom de l'instance.
InstanceClass : Type d'instance.
VpcId : ID du VPC.
Capacity : Capacité de stockage de l'instance.
InstanceType : Version du moteur de base de données de l'instance.
ChargeType : Méthode de facturation de l'instance.
PackageType : Type de plan.
Connections : Nombre maximal de connexions prises en charge par l'instance.
ArchitectureType : Type d'architecture.
NodeType : Type de nœud.
HasRenewChangeOrder : Indique si le compte Alibaba Cloud dispose de commandes de renouvellement ou d'extension en attente.
ResourceGroupId : ID du groupe de ressources.
QPS : Nombre de requêtes par seconde (QPS). Il s'agit de la valeur théorique pour le type d'instance actuel.
ZoneId : ID de la zone à laquelle appartient l'instance.
Bandwidth : Bande passante de l'instance. Unité : Mbps.
EngineVersion : Version du moteur.
NetworkType : Type de réseau.
VSwitchId : ID du vSwitch.
PrivateIp : Adresse IP privée de l'instance.
PublicConnectionString : Chaîne de connexion publique de l'instance.
VpcPrivateConnectionPort : Port de connexion privée VPC.
ClassicInnerConnectionString : Chaîne de connexion interne classique de l'instance.
VpcPrivateConnectionString : Chaîne de connexion privée VPC de l'instance.
PublicConnectionPort : Port de connexion publique de l'instance.
DirectConnectionString : Chaîne de connexion directe de l'instance.
DirectConnectionPort : Port de connexion directe de l'instance.
ClassicInnerConnectionPort : Port de connexion interne classique de l'instance.
Exemples
Scénario 1 : Créer une instance Redis.
ROSTemplateFormatVersion: '2015-09-01'
Description: {}
Parameters:
VpcId:
Type: String
AssociationProperty: ALIYUN::ECS::VPC::VpcId
ZoneId:
Type: String
Description:
zh-cn: Before creating an instance, confirm the Availability Zone supports Redis resource specifications.
en: Before creating an instance, confirm the Availability Zone supports Redis resource specifications.
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Label:
en: Zone ID
zh-cn: Zone ID
VSwitchId:
Type: String
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId}
Resources:
RedisInstance:
Type: ALIYUN::REDIS::Instance
Properties:
VpcId:
Ref: VpcId
VSwitchId:
Ref: VSwitchId
InstanceClass: redis.master.small.default
EvictionPolicy: noeviction
ZoneId:
Ref: ZoneId
InstanceName: DefaultRedis
Password: Admin@123!
Outputs:
InstanceId:
Value:
Fn::GetAtt:
- RedisInstance
- InstanceId {
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
},
"Parameters": {
"VpcId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::VPC::VpcId"
},
"ZoneId": {
"Type": "String",
"Description": {
"zh-cn": "Before creating an instance, confirm the Availability Zone supports Redis resource specifications.",
"en": "Before creating an instance, confirm the Availability Zone supports Redis resource specifications."
},
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Label": {
"en": "Zone ID",
"zh-cn": "Zone ID"
}
},
"VSwitchId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${ZoneId}"
}
}
},
"Resources": {
"RedisInstance": {
"Type": "ALIYUN::REDIS::Instance",
"Properties": {
"VpcId": {
"Ref": "VpcId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"InstanceClass": "redis.master.small.default",
"EvictionPolicy": "noeviction",
"ZoneId": {
"Ref": "ZoneId"
},
"InstanceName": "DefaultRedis",
"Password": "Admin@123!"
}
}
},
"Outputs": {
"InstanceId": {
"Value": {
"Fn::GetAtt": [
"RedisInstance",
"InstanceId"
]
}
}
}
}Scénario 2 : Créer une instance Redis et ajouter une liste d'autorisation d'adresses IP.
ROSTemplateFormatVersion: '2015-09-01'
Description: {}
Parameters:
VpcId:
Type: String
AssociationProperty: ALIYUN::ECS::VPC::VpcId
ZoneId:
Type: String
Description:
zh-cn: Before creating an instance, confirm the Availability Zone supports Redis resource specifications.
en: Before creating an instance, confirm the Availability Zone supports Redis resource specifications.
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Label:
en: Zone ID
zh-cn: Zone ID
VSwitchId:
Type: String
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId}
Resources:
RedisInstance:
Type: ALIYUN::REDIS::Instance
Properties:
VpcId:
Ref: VpcId
VSwitchId:
Ref: VSwitchId
InstanceClass: redis.master.small.default
EvictionPolicy: noeviction
ZoneId:
Ref: ZoneId
InstanceName: DefaultRedis
Password: Admin@123!
REDISWhitelist:
Type: ALIYUN::REDIS::Whitelist
Properties:
InstanceId:
Ref: RedisInstance
SecurityIps: 192.168.0.0/16
Outputs:
InstanceId:
Value:
Fn::GetAtt:
- RedisInstance
- InstanceId {
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {},
"Parameters": {
"VpcId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::VPC::VpcId"
},
"ZoneId": {
"Type": "String",
"Description": {
"zh-cn": "Before creating an instance, confirm the Availability Zone supports Redis resource specifications.",
"en": "Before creating an instance, confirm the Availability Zone supports Redis resource specifications."
},
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Label": {
"en": "Zone ID",
"zh-cn": "Zone ID"
}
},
"VSwitchId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${ZoneId}"
}
}
},
"Resources": {
"RedisInstance": {
"Type": "ALIYUN::REDIS::Instance",
"Properties": {
"VpcId": {
"Ref": "VpcId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"InstanceClass": "redis.master.small.default",
"EvictionPolicy": "noeviction",
"ZoneId": {
"Ref": "ZoneId"
},
"InstanceName": "DefaultRedis",
"Password": "Admin@123!"
}
},
"REDISWhitelist": {
"Type": "ALIYUN::REDIS::Whitelist",
"Properties": {
"InstanceId": {
"Ref": "RedisInstance"
},
"SecurityIps": "192.168.0.0/16"
}
}
},
"Outputs": {
"InstanceId": {
"Value": {
"Fn::GetAtt": [
"RedisInstance",
"InstanceId"
]
}
}
}
}Scénario 3 : Utiliser DTS pour synchroniser le cache entre MySQL et Redis.
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: This template synchronizes MySQL and Redis caches using DTS. It creates and configures security for VPC, ECS, RDS, and Redis instances. It also establishes consumer groups to ensure data consistency.
en: This template synchronizes MySQL and Redis caches using DTS. It creates and configures security for VPC, ECS, RDS, and Redis instances. It also establishes consumer groups to ensure data consistency.
Parameters:
ZoneId:
Type: String
Label:
en: VSwitch Availability Zone
zh-cn: VSwitch Availability Zone
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
RDSDBUser:
Type: String
Label:
en: RDS DB Username
zh-cn: RDS DB Username
Description:
en: Username of database.
zh-cn: Username of database.
ConstraintDescription:
en: Must contain 2 to 16 lowercase letters and underscores. It must start with a letter and end with an alphanumeric character.
zh-cn: Must contain 2 to 16 lowercase letters and underscores. It must start with a letter and end with an alphanumeric character.
Default: demouser123
MinLength: 2
MaxLength: 16
DbName:
Type: String
Label:
en: RDS DB Name
zh-cn: RDS DB Name
ConstraintDescription:
en: Must contain 2 to 16 lowercase letters and underscores. It must start with a letter and end with an alphanumeric character.
zh-cn: Must contain 2 to 16 lowercase letters and underscores. It must start with a letter and end with an alphanumeric character.
Default: demodb
Required: true
MinLength: 2
MaxLength: 16
RDSDBPassword:
Type: String
Label:
en: RDS DB Password
zh-cn: RDS DB Password
Description:
en: The RDS database password must be 8 to 32 characters long. It must contain letters, numbers, and underscores (_). It must also include three different character types.
zh-cn: The RDS database password must be 8 to 32 characters long. It must contain letters, numbers, and underscores (_). It must also include three different character types.
ConstraintDescription:
en: Must be 8 to 32 characters long. It must contain letters, numbers, and underscores (_).
zh-cn: Must be 8 to 32 characters long. It must contain letters, numbers, and underscores (_).
AssociationProperty: ALIYUN::RDS::Instance::AccountPassword
MinLength: 8
MaxLength: 32
NoEcho: true
DBInstanceClass:
Type: String
Label:
en: Instance Class
zh-cn: Instance Class
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${ZoneId}
EngineVersion: "8.0"
Engine: MySQL
Category: HighAvailability
DBInstanceStorageType: cloud_essd
CommodityCode: bards
Default: mysql.x4.medium.2c
DtsJobName:
Type: String
Label:
en: Dts Job Name
zh-cn: Dts Job Name
Description:
en: Set a name that reflects its business purpose for easy identification. Uniqueness is not required.
zh-cn: Set a name that reflects its business purpose for easy identification. Uniqueness is not required.
Default: mysql2redis_dts
RedisInstanceClass:
Type: String
Label:
en: Tair Specifications
zh-cn: Tair Specifications
Description:
en: <font color='blue'>Before selecting a model, confirm if the model is in stock in the current availability zone. To save testing costs, use a 2 GB memory model, such as tair.rdb.2g.</font> For more information, see <a href='https://www.alibabacloud.com/help/zh/redis/product-overview/enhanced-performance' target='_blank'><font color='red'>Specification inquiry</font></a>.
zh-cn: <font color='blue'>Before selecting a model, confirm if the model is in stock in the current availability zone. To save testing costs, use a 2 GB memory model, such as tair.rdb.2g.</font> For more information, see <a href='https://www.alibabacloud.com/help/zh/redis/product-overview/enhanced-performance' target='_blank'><font color='red'>Specification inquiry</font></a>.
AssociationProperty: ALIYUN::REDIS::Instance::InstanceClass
AssociationPropertyMetadata:
Engine: Redis
ProductType: Tair_rdb
InstanceChargeType: PostPaid
ZoneId: ${ZoneId1}
OrderType: BUY
Default: tair.rdb.2g
RedisPassword:
Type: String
Label:
en: Instance Password
zh-cn: Instance Password
Description:
en: Must be 8 to 32 characters long. It can contain uppercase and lowercase letters, numbers, and special symbols: ! @ # $ % ^ & * ( ) _ + - =
zh-cn: Must be 8 to 32 characters long. It can contain uppercase and lowercase letters, numbers, and special symbols: ! @ # $ % ^ & * ( ) _ + - =
ConstraintDescription:
en: Must be 8 to 32 characters long. It can contain uppercase and lowercase letters, numbers, and special symbols: ! @ # $ % ^ & * ( ) _ + - =
zh-cn: Must be 8 to 32 characters long. It can contain uppercase and lowercase letters, numbers, and special symbols: ! @ # $ % ^ & * ( ) _ + - =
MinLength: '8'
MaxLength: '32'
NoEcho: true
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: Vpc
VSwitchName:
Fn::Join:
- '-'
- - VSwitch
- StackId
- Ref: ALIYUN::StackId
CidrBlock: 192.168.0.0/24
RdsDBInstance:
Type: ALIYUN::RDS::DBInstance
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
DBInstanceClass:
Ref: DBInstanceClass
DBInstanceStorage: 100
Engine: MySQL
EngineVersion: "8.0"
MasterUserPassword:
Ref: RDSDBPassword
MasterUserType: Super
MasterUsername:
Ref: RDSDBUser
DBMappings:
- CharacterSetName: utf8mb4
DBName:
Ref: DbName
Category: HighAvailability
DBInstanceStorageType: cloud_essd
SecurityIPList: 192.168.0.0/16
SlaveZoneIds:
- Ref: ZoneId
RedisInstance:
Type: ALIYUN::REDIS::Instance
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
InstanceClass:
Ref: RedisInstanceClass
InstanceName: rds_mysql2redis_redis
EvictionPolicy: noeviction
EngineVersion: '6.0'
Password:
Ref: RedisPassword
Whitelist:
Type: ALIYUN::REDIS::Whitelist
Properties:
InstanceId:
Ref: RedisInstance
SecurityIps: 192.168.0.0/16
MigrationJob:
Type: ALIYUN::DTS::SynchronizationJob2
Properties:
DtsJobName:
Ref: DtsJobName
SourceEndpoint:
InstanceType: RDS
InstanceID:
Ref: RdsDBInstance
EngineName: MYSQL
Region:
Ref: ALIYUN::Region
UserName:
Ref: RDSDBUser
Password:
Ref: RDSDBPassword
DestinationEndpoint:
InstanceType: Redis
InstanceID:
Ref: RedisInstance
EngineName: Redis
Region:
Ref: ALIYUN::Region
Password:
Ref: RedisPassword
StructureInitialization: false
DelayNotice: true
ErrorNotice: true
DelayRuleTime: 60
DataInitialization: true
DataSynchronization: true
DbList:
Fn::GetJsonValue:
- DbList
- Fn::Sub: '{ "DbList": { "${DbName}": { "name": "0", "all": true, "customAttachedColumn": { "__DTS_TP_TO_REDIS_KEY__": { "name": "__DTS_TP_TO_REDIS_KEY__", "syntacticType": "ADD", "value": "__DB__+''.''+__TB__+''.''+pk_str_with_name_value(''.'',''.'')", "type": "STRING", "length": "" }, "__DTS_TP_TO_REDIS_VALUE__": { "name": "__DTS_TP_TO_REDIS_VALUE__", "syntacticType": "ADD", "value": "tp2redis_json_value()", "type": "STRING", "length": "" } } }}}'
DtsInstance:
Type: ALIYUN::DTS::Instance
Properties:
JobId:
Fn::GetAtt:
- MigrationJob
- DtsJobId
InstanceClass: small
PayType: PostPaid
AutoStart: true
Type: SYNC
SourceRegion:
Ref: ALIYUN::Region
DestinationRegion:
Ref: ALIYUN::Region
SourceEndpointEngineName: MySQL
DestinationEndpointEngineName: Redis
Outputs:
RdsInstanceAddress:
Description:
en: RDS Instance Address.
zh-cn: RDS Instance Address.
Value:
'Fn::Sub':
- 'https://rds.console.alibabacloud.com/detail/${InstanceID}/basicInfo?region=${Region}'
- InstanceID:
Ref: RdsDBInstance
Region:
Ref: ALIYUN::Region
TairInstanceAddress:
Description:
en: Tair Instance Address.
zh-cn: Tair Instance Address.
Value:
'Fn::Sub':
- 'https://kvstore.console.alibabacloud.com/Redis/instance/${Region}/${InstanceID}'
- InstanceID:
Ref: RedisInstance
Region:
Ref: ALIYUN::Region
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- ZoneId
Label:
default:
en: Infrastructure Configuration (Required)
zh-cn: Infrastructure Configuration (Required)
- Parameters:
- DBInstanceClass
- DbName
- RDSDBUser
- RDSDBPassword
Label:
default: RDS
- Parameters:
- RedisInstanceClass
- RedisPassword
Label:
default: Tair
- Parameters:
- DtsJobName
Label:
default: DTS
TemplateTags:
- acs:technical-solution:database:real-time synchronization of RDS and Redis to build cache consistency-tech_solu_21
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "This template synchronizes MySQL and Redis caches using DTS. It creates and configures security for VPC, ECS, RDS, and Redis instances. It also establishes consumer groups to ensure data consistency.",
"en": "This template synchronizes MySQL and Redis caches using DTS. It creates and configures security for VPC, ECS, RDS, and Redis instances. It also establishes consumer groups to ensure data consistency."
},
"Parameters": {
"ZoneId": {
"Type": "String",
"Label": {
"en": "VSwitch Availability Zone",
"zh-cn": "VSwitch Availability Zone"
},
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
},
"RDSDBUser": {
"Type": "String",
"Label": {
"en": "RDS DB Username",
"zh-cn": "RDS DB Username"
},
"Description": {
"en": "Username of database.",
"zh-cn": "Username of database."
},
"ConstraintDescription": {
"en": "Must contain 2 to 16 lowercase letters and underscores. It must start with a letter and end with an alphanumeric character.",
"zh-cn": "Must contain 2 to 16 lowercase letters and underscores. It must start with a letter and end with an alphanumeric character."
},
"Default": "demouser123",
"MinLength": 2,
"MaxLength": 16
},
"DbName": {
"Type": "String",
"Label": {
"en": "RDS DB Name",
"zh-cn": "RDS DB Name"
},
"ConstraintDescription": {
"en": "Must contain 2 to 16 lowercase letters and underscores. It must start with a letter and end with an alphanumeric character.",
"zh-cn": "Must contain 2 to 16 lowercase letters and underscores. It must start with a letter and end with an alphanumeric character."
},
"Default": "demodb",
"Required": true,
"MinLength": 2,
"MaxLength": 16
},
"RDSDBPassword": {
"Type": "String",
"Label": {
"en": "RDS DB Password",
"zh-cn": "RDS DB Password"
},
"Description": {
"en": "The RDS database password must be 8 to 32 characters long. It must contain letters, numbers, and underscores (_). It must also include three different character types.",
"zh-cn": "The RDS database password must be 8 to 32 characters long. It must contain letters, numbers, and underscores (_). It must also include three different character types."
},
"ConstraintDescription": {
"en": "Must be 8 to 32 characters long. It must contain letters, numbers, and underscores (_).",
"zh-cn": "Must be 8 to 32 characters long. It must contain letters, numbers, and underscores (_)."
},
"AssociationProperty": "ALIYUN::RDS::Instance::AccountPassword",
"MinLength": 8,
"MaxLength": 32,
"NoEcho": true
},
"DBInstanceClass": {
"Type": "String",
"Label": {
"en": "Instance Class",
"zh-cn": "Instance Class"
},
"AssociationProperty": "ALIYUN::RDS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"ZoneId": "${ZoneId}",
"EngineVersion": "8.0",
"Engine": "MySQL",
"Category": "HighAvailability",
"DBInstanceStorageType": "cloud_essd",
"CommodityCode": "bards"
},
"Default": "mysql.x4.medium.2c"
},
"DtsJobName": {
"Type": "String",
"Label": {
"en": "Dts Job Name",
"zh-cn": "Dts Job Name"
},
"Description": {
"en": "Set a name that reflects its business purpose for easy identification. Uniqueness is not required.",
"zh-cn": "Set a name that reflects its business purpose for easy identification. Uniqueness is not required."
},
"Default": "mysql2redis_dts"
},
"RedisInstanceClass": {
"Type": "String",
"Label": {
"en": "Tair Specifications",
"zh-cn": "Tair Specifications"
},
"Description": {
"en": "<font color='blue'>Before selecting a model, confirm if the model is in stock in the current availability zone. To save testing costs, use a 2 GB memory model, such as tair.rdb.2g.</font> For more information, see <a href='https://www.alibabacloud.com/help/zh/redis/product-overview/enhanced-performance' target='_blank'><font color='red'>Specification inquiry</font></a>.",
"zh-cn": "<font color='blue'>Before selecting a model, confirm if the model is in stock in the current availability zone. To save testing costs, use a 2 GB memory model, such as tair.rdb.2g.</font> For more information, see <a href='https://www.alibabacloud.com/help/zh/redis/product-overview/enhanced-performance' target='_blank'><font color='red'>Specification inquiry</font></a>."
},
"AssociationProperty": "ALIYUN::REDIS::Instance::InstanceClass",
"AssociationPropertyMetadata": {
"Engine": "Redis",
"ProductType": "Tair_rdb",
"InstanceChargeType": "PostPaid",
"ZoneId": "${ZoneId1}",
"OrderType": "BUY"
},
"Default": "tair.rdb.2g"
},
"RedisPassword": {
"Type": "String",
"Label": {
"en": "Instance Password",
"zh-cn": "Instance Password"
},
"Description": {
"en": "Must be 8 to 32 characters long. It can contain uppercase and lowercase letters, numbers, and special symbols: ! @ # $ % ^ & * ( ) _ + - =",
"zh-cn": "Must be 8 to 32 characters long. It can contain uppercase and lowercase letters, numbers, and special symbols: ! @ # $ % ^ & * ( ) _ + - ="
},
"ConstraintDescription": {
"en": "Must be 8 to 32 characters long. It can contain uppercase and lowercase letters, numbers, and special symbols: ! @ # $ % ^ & * ( ) _ + - =",
"zh-cn": "Must be 8 to 32 characters long. It can contain uppercase and lowercase letters, numbers, and special symbols: ! @ # $ % ^ & * ( ) _ + - ="
},
"MinLength": "8",
"MaxLength": "32",
"NoEcho": true
}
},
"Resources": {
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": "192.168.0.0/16"
}
},
"VSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"ZoneId": {
"Ref": "ZoneId"
},
"VpcId": {
"Ref": "Vpc"
},
"VSwitchName": {
"Fn::Join": [
"-",
[
"VSwitch",
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
},
"CidrBlock": "192.168.0.0/24"
}
},
"RdsDBInstance": {
"Type": "ALIYUN::RDS::DBInstance",
"Properties": {
"ZoneId": {
"Ref": "ZoneId"
},
"VpcId": {
"Ref": "Vpc"
},
"VSwitchId": {
"Ref": "VSwitch"
},
"DBInstanceClass": {
"Ref": "DBInstanceClass"
},
"DBInstanceStorage": 100,
"Engine": "MySQL",
"EngineVersion": "8.0",
"MasterUserPassword": {
"Ref": "RDSDBPassword"
},
"MasterUserType": "Super",
"MasterUsername": {
"Ref": "RDSDBUser"
},
"DBMappings": [
{
"CharacterSetName": "utf8mb4",
"DBName": {
"Ref": "DbName"
}
}
],
"Category": "HighAvailability",
"DBInstanceStorageType": "cloud_essd",
"SecurityIPList": "192.168.0.0/16",
"SlaveZoneIds": [
{
"Ref": "ZoneId"
}
]
}
},
"RedisInstance": {
"Type": "ALIYUN::REDIS::Instance",
"Properties": {
"ZoneId": {
"Ref": "ZoneId"
},
"VpcId": {
"Ref": "Vpc"
},
"VSwitchId": {
"Ref": "VSwitch"
},
"InstanceClass": {
"Ref": "RedisInstanceClass"
},
"InstanceName": "rds_mysql2redis_redis",
"EvictionPolicy": "noeviction",
"EngineVersion": "6.0",
"Password": {
"Ref": "RedisPassword"
}
}
},
"Whitelist": {
"Type": "ALIYUN::REDIS::Whitelist",
"Properties": {
"InstanceId": {
"Ref": "RedisInstance"
},
"SecurityIps": "192.168.0.0/16"
}
},
"MigrationJob": {
"Type": "ALIYUN::DTS::SynchronizationJob2",
"Properties": {
"DtsJobName": {
"Ref": "DtsJobName"
},
"SourceEndpoint": {
"InstanceType": "RDS",
"InstanceID": {
"Ref": "RdsDBInstance"
},
"EngineName": "MYSQL",
"Region": {
"Ref": "ALIYUN::Region"
},
"UserName": {
"Ref": "RDSDBUser"
},
"Password": {
"Ref": "RDSDBPassword"
}
},
"DestinationEndpoint": {
"InstanceType": "Redis",
"InstanceID": {
"Ref": "RedisInstance"
},
"EngineName": "Redis",
"Region": {
"Ref": "ALIYUN::Region"
},
"Password": {
"Ref": "RedisPassword"
}
},
"StructureInitialization": false,
"DelayNotice": true,
"ErrorNotice": true,
"DelayRuleTime": 60,
"DataInitialization": true,
"DataSynchronization": true,
"DbList": {
"Fn::GetJsonValue": [
"DbList",
{
"Fn::Sub": "{ \"DbList\": { \"${DbName}\": { \"name\": \"0\", \"all\": true, \"customAttachedColumn\": { \"__DTS_TP_TO_REDIS_KEY__\": { \"name\": \"__DTS_TP_TO_REDIS_KEY__\", \"syntacticType\": \"ADD\", \"value\": \"__DB__+'.'+__TB__+'.'+pk_str_with_name_value('.','.')\", \"type\": \"STRING\", \"length\": \"\" }, \"__DTS_TP_TO_REDIS_VALUE__\": { \"name\": \"__DTS_TP_TO_REDIS_VALUE__\", \"syntacticType\": \"ADD\", \"value\": \"tp2redis_json_value()\", \"type\": \"STRING\", \"length\": \"\" } } }}}"
}
]
}
}
},
"DtsInstance": {
"Type": "ALIYUN::DTS::Instance",
"Properties": {
"JobId": {
"Fn::GetAtt": [
"MigrationJob",
"DtsJobId"
]
},
"InstanceClass": "small",
"PayType": "PostPaid",
"AutoStart": true,
"Type": "SYNC",
"SourceRegion": {
"Ref": "ALIYUN::Region"
},
"DestinationRegion": {
"Ref": "ALIYUN::Region"
},
"SourceEndpointEngineName": "MySQL",
"DestinationEndpointEngineName": "Redis"
}
}
},
"Outputs": {
"RdsInstanceAddress": {
"Description": {
"en": "RDS Instance Address.",
"zh-cn": "RDS Instance Address."
},
"Value": {
"Fn::Sub": [
"https://rds.console.alibabacloud.com/detail/${InstanceID}/basicInfo?region=${Region}",
{
"InstanceID": {
"Ref": "RdsDBInstance"
},
"Region": {
"Ref": "ALIYUN::Region"
}
}
]
}
},
"TairInstanceAddress": {
"Description": {
"en": "Tair Instance Address.",
"zh-cn": "Tair Instance Address."
},
"Value": {
"Fn::Sub": [
"https://kvstore.console.alibabacloud.com/Redis/instance/${Region}/${InstanceID}",
{
"InstanceID": {
"Ref": "RedisInstance"
},
"Region": {
"Ref": "ALIYUN::Region"
}
}
]
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"ZoneId"
],
"Label": {
"default": {
"en": "Infrastructure Configuration (Required)",
"zh-cn": "Infrastructure Configuration (Required)"
}
}
},
{
"Parameters": [
"DBInstanceClass",
"DbName",
"RDSDBUser",
"RDSDBPassword"
],
"Label": {
"default": "RDS"
}
},
{
"Parameters": [
"RedisInstanceClass",
"RedisPassword"
],
"Label": {
"default": "Tair"
}
},
{
"Parameters": [
"DtsJobName"
],
"Label": {
"default": "DTS"
}
}
],
"TemplateTags": [
"acs:technical-solution:database:real-time synchronization of RDS and Redis to build cache consistency-tech_solu_21"
]
}
}
}Pour plus d'exemples, consultez modèles publics contenant cette ressource.