From 09588c63e1013ad47eca8f402fa005d5e5dce82f Mon Sep 17 00:00:00 2001 From: qitan Date: Wed, 22 Nov 2023 09:45:41 +0800 Subject: [PATCH] fix technical-solution template --- README-CN.md | 18 +- README.md | 8 +- ...e-model-based-on-ChatGLM-and-LangChain.yml | 2 +- .../data-transmission-from-ECS-to-RDS.yml | 325 ++++++++++++++++++ .../migrate-rds-mysql-to-polardb-mysql.yml | 3 +- .../alb-cross-region-load-balance.yml | 6 +- ...l => mse-realizes-full-link-grayscale.yml} | 10 + ...-region-three-center-high-availability.yml | 2 +- .../solution/storage/snapshot-optimize.yml | 305 ++++++++++++++++ 9 files changed, 662 insertions(+), 17 deletions(-) create mode 100644 documents/solution/database/data-transmission-from-ECS-to-RDS.yml rename documents/solution/micro/{mse-end-to-end-canary-release-for-ack-application.yml => mse-realizes-full-link-grayscale.yml} (97%) create mode 100644 documents/solution/storage/snapshot-optimize.yml diff --git a/README-CN.md b/README-CN.md index 43cf20fa..3c6da1e1 100644 --- a/README-CN.md +++ b/README-CN.md @@ -453,19 +453,20 @@ ROS 模板的示例和最佳实践。模板分类如下: - database -| 模板 | 说明 | -|------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| +| 模板 | 说明 | +|-----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| | [automatic-database-scaling-and-SQL-optimization.yml](documents/solution/database/automatic-database-scaling-and-SQL-optimization.yml) | 数据库自动扩缩容和自动SQL优化。 | [解决方案](https://aliyun.com/solution/tech-solution/adsa_sql) | | [wordpress-website-database-on-the-cloud.yml](documents/solution/database/wordpress-website-database-on-the-cloud.yml) | WordPress网站数据库上云。 | | [dts-cache-synchronization.yml](documents/solution/database/dts-cache-synchronization.yml) | 通过DTS实现MySQL与Redis缓存同步一致性方案。 | [解决方案](https://aliyun.com/solution/tech-solution/rtsorarctebcc) | -| [migrate-rds-mysql-to-polardb-mysql.yml](documents/solution/database/migrate-rds-mysql-to-polardb-mysql.yml) | 在不修改应用程序任何代码和配置的情况下,将RDS MySQL在线一键升级至PolarDB MySQL版。 | [解决方案](https://www.aliyun.com/solution/tech-solution/rds_polardb) | +| [migrate-rds-mysql-to-polardb-mysql.yml](documents/solution/database/migrate-rds-mysql-to-polardb-mysql.yml) | 在不修改应用程序任何代码和配置的情况下,将RDS MySQL在线一键升级至PolarDB MySQL版。 | [解决方案](https://www.aliyun.com/solution/tech-solution/rds_polardb) | | [one-stop-htap-service.yml](documents/solution/database/one-stop-htap-service.yml) | RDS+ClickHouse构建一站式HTAP。 | [解决方案](https://aliyun.com/solution/tech-solution/rdsclickhouse_htap) | +| [data-transmission-from-ECS-to-RDS.yml](documents/solution/database/data-transmission-from-ECS-to-RDS.yml) | 网站数据库平滑迁移上云。 | [解决方案](https://www.aliyun.com/solution/tech-solution/smowdttc) | - micro | 模板 | 说明 | |--------------------------------------------------------------------------------------------------------------------------|-------------------| -| [mse-end-to-end-canary-release-for-ack-application.yml](./documents/solution/micro/mse-end-to-end-canary-release-for-ack-application.yml) | 基于MSE实现ACK应用的全链路灰度。 | [解决方案](https://aliyun.com/solution/tech-solution/iflgbomse) | +| [mse-end-to-end-canary-release-for-ack-application.yml](./documents/solution/micro/mse-realizes-full-link-grayscale.yml) | 基于MSE实现ACK应用的全链路灰度。 | [解决方案](https://aliyun.com/solution/tech-solution/iflgbomse) | - network @@ -479,11 +480,12 @@ ROS 模板的示例和最佳实践。模板分类如下: - storage -| 模板 | 说明 | -|-----------------------------------------------------------------------------------------------------------------------------|---------------------| +| 模板 | 说明 | +|---------------------------------------------------------------------------------------------------------------------------|---------------------| | [collect-logs-across-alibaba-cloud-accounts.yml](documents/solution/storage/collect-logs-across-alibaba-cloud-accounts.yml) | 跨阿里云账号采集日志。 | [解决方案](https://aliyun.com/solution/tech-solution/cacac_logs) | -| [collect-cross-account-logs-by-auditing.yml](documents/solution/storage/collect-cross-account-logs-by-auditing.yml) | 通过日志审计服务跨账号采集OSS日志。 | -| [cloud-native-observable-operation-and-maintenance.yml](documents/solution/storage/cloud-native-observable-operation-and-maintenance.yml) | 云原生可观测运维。 | +| [collect-cross-account-logs-by-auditing.yml](documents/solution/storage/collect-cross-account-logs-by-auditing.yml) | 通过日志审计服务跨账号采集OSS日志。 | +| [cloud-native-observable-operation-and-maintenance.yml](documents/solution/storage/cloud-native-observable-operation-and-maintenance.yml) | 云原生可观测运维。 | +| [snapshot-optimize.yml](documents/solution/storage/snapshot-optimize.yml) | 基于EBS部署高性能的MySQL服务。 | - cdn-and-video-cloud diff --git a/README.md b/README.md index 8ed0a397..7adcf84d 100644 --- a/README.md +++ b/README.md @@ -457,19 +457,20 @@ Examples and best practices of ROS templates. The templates are categorized as f - database -| Template | Description | -|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| +| Template | Description | +|------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | [automatic-database-scaling-and-SQL-optimization.yml](documents/solution/database/automatic-database-scaling-and-SQL-optimization.yml) | Automatic database scaling and SQL optimization| | [wordpress-website-database-on-the-cloud.yml](documents/solution/database/wordpress-website-database-on-the-cloud.yml) | WordPress website database on the cloud. | | [dts-cache-synchronization.yml](documents/solution/database/dts-cache-synchronization.yml) | The consistency scheme of cache synchronization between MySQL and Redis is implemented by DTS . | | [migrate-rds-mysql-to-polardb-mysql.yml](documents/solution/database/migrate-rds-mysql-to-polardb-mysql.yml) | Online one-click upgrade of RDS MySQL to PolarDB MySQL version without modifying any code and configuration of the application. | | [one-stop-htap-service.yml](documents/solution/database/one-stop-htap-service.yml) | Build a one-stop HTAP service based on RDS and ClickHouse. | +| [data-transmission-from-ECS-to-RDS.yml](documents/solution/database/data-transmission-from-ECS-to-RDS.yml) | Data transmission from ECS self-built database to RDS database. | - micro | Template | Description | |------------------------------------------------------------------------------------------------------------------------|-----------------| -| [mse-end-to-end-canary-release-for-ack-application.yml](./documents/solution/micro/mse-end-to-end-canary-release-for-ack-application.yml) | MSE end-to-end canary release for ACK application. | +| [mse-end-to-end-canary-release-for-ack-application.yml](./documents/solution/micro/mse-realizes-full-link-grayscale.yml) | MSE end-to-end canary release for ACK application. | - network @@ -488,6 +489,7 @@ Examples and best practices of ROS templates. The templates are categorized as f | [collect-logs-across-alibaba-cloud-accounts.yml](documents/solution/storage/collect-logs-across-alibaba-cloud-accounts.yml) | Collect logs across Alibaba cloud accounts. | | [collect-cross-account-logs-by-auditing.yml](documents/solution/storage/collect-cross-account-logs-by-auditing.yml) | Collect logs of OSS across accounts with log audit service. | | [cloud-native-observable-operation-and-maintenance.yml](documents/solution/storage/cloud-native-observable-operation-and-maintenance.yml) | Cloud-native observable operation and maintenance. | +| [snapshot-optimize.yml](documents/solution/storage/snapshot-optimize.yml) | Deploy high-performance MySQL services based on EBS ESSD. | - cdn-and-video-cloud diff --git a/documents/solution/ai/build-a-dialogue-model-based-on-ChatGLM-and-LangChain.yml b/documents/solution/ai/build-a-dialogue-model-based-on-ChatGLM-and-LangChain.yml index bf547870..22c16fbd 100644 --- a/documents/solution/ai/build-a-dialogue-model-based-on-ChatGLM-and-LangChain.yml +++ b/documents/solution/ai/build-a-dialogue-model-based-on-ChatGLM-and-LangChain.yml @@ -218,4 +218,4 @@ Metadata: en: PAI-EAS zh-cn: PAI服务 TemplateTags: - - acs:technical-solution:AI:基于ChatGLM和LangChain搭建对话模型 \ No newline at end of file + - acs:technical-solution:AI:ChatGLM和LangChain搭建对话模型 \ No newline at end of file diff --git a/documents/solution/database/data-transmission-from-ECS-to-RDS.yml b/documents/solution/database/data-transmission-from-ECS-to-RDS.yml new file mode 100644 index 00000000..e7e215dc --- /dev/null +++ b/documents/solution/database/data-transmission-from-ECS-to-RDS.yml @@ -0,0 +1,325 @@ +ROSTemplateFormatVersion: '2015-09-01' +Description: + zh-cn: ECS自建数据库迁移至RDS数据库 + en: Data transmission from ECS self-built database to RDS database +Metadata: + ALIYUN::ROS::Interface: + ParameterGroups: + - Parameters: + - InstancePassword + Label: + default: ECS + - Parameters: + - DBInstanceEngineAndVersion + - DBInstanceClass + - DBUserName + - DBPassword + Label: + default: RDS + TemplateTags: + - acs:technical-solution:database:网站数据库平滑迁移上云 +Parameters: + InstancePassword: + NoEcho: true + Type: String + Description: + en: Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in). + zh-cn: 服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。 + Label: + zh-cn: 实例密码 + en: Instance Password + ConstraintDescription: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。 + AllowedPattern: '[0-9A-Za-z\_\-\&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$' + DBInstanceEngineAndVersion: + Type: String + Description: + zh-cn: 数据库引擎类型及版本,默认为MySQL 8.0 + en: 'Database instance engine type and version, default: MySQL 8.0' + Label: + zh-cn: 引擎类型及版本 + en: Engine And Version + Default: MySQL 8.0 + AllowedValues: + - MySQL 5.7 + - MySQL 8.0 + DBInstanceClass: + Type: String + Label: + en: RDS Instance Class + zh-cn: RDS实例规格 + AssociationProperty: ALIYUN::RDS::Instance::InstanceType + AssociationPropertyMetadata: + ZoneId: ${ZoneId} + EngineVersion: '8.0' + DBInstanceStorageType: cloud_essd + Engine: MySQL + Category: HighAvailability + DBUserName: + Type: String + Description: + en: Username of RDS database + zh-cn: RDS数据库账号 + ConstraintDescription: + en: Consist of 2 to 16 characters of lowercase letters, underline. Must begin with a letter and be end with an alphanumeric character + zh-cn: 由 2 到 16 个小写字母组成,下划线。必须以字母开头,以字母数字字符结尾 + Label: + zh-cn: RDS数据库账号 + en: RDS DB Username + Default: dbuser + MaxLength: 16 + MinLength: 2 + DBPassword: + Type: String + Description: + en: RDS database password, consisting of letters, numbers, and underline(_), is 8 to 32 characters long + zh-cn: RDS数据库密码,由字母、数字、下划线(_)组成,长度为8~32个字符 + ConstraintDescription: + en: '[8, 32] characters consist of alphanumeric characters, hyphen and underline' + zh-cn: '[8, 32] 个字符由字母数字字符、连字符和下划线组成' + Label: + zh-cn: RDS数据库密码 + en: RDS DB Password + MaxLength: 32 + MinLength: 8 + NoEcho: true +Resources: + RosWaitCondition: + Type: ALIYUN::ROS::WaitCondition + Properties: + Count: 1 + Handle: + Ref: RosWaitConditionHandle + Timeout: 3600 + RosWaitConditionHandle: + Type: ALIYUN::ROS::WaitConditionHandle + VSwitch: + Type: ALIYUN::ECS::VSwitch + Properties: + CidrBlock: 192.168.0.0/24 + ZoneId: cn-hangzhou-j + VpcId: + Fn::GetAtt: + - Vpc + - VpcId + VswitchSlave1: + Type: ALIYUN::ECS::VSwitch + Properties: + CidrBlock: 192.168.1.0/24 + ZoneId: cn-hangzhou-k + VpcId: + Fn::GetAtt: + - Vpc + - VpcId + Vpc: + Type: ALIYUN::ECS::VPC + Properties: + CidrBlock: 192.168.0.0/16 + VpcName: wordpress_vpc + SecurityGroup: + Type: ALIYUN::ECS::SecurityGroup + Properties: + SecurityGroupName: SG-DTS-GROUP-20220101 + VpcId: + Fn::GetAtt: + - Vpc + - VpcId + Database: + Type: ALIYUN::RDS::DBInstance + Properties: + DBInstanceClass: mysql.n2m.small.2c + ZoneId: cn-hangzhou-k + SlaveZoneIds: + - cn-hangzhou-k + DBInstanceDescription: RDS-DB + DBInstanceStorage: 20 + Category: HighAvailability + DBInstanceStorageType: cloud_essd + VSwitchId: + Ref: VSwitch + Engine: + Fn::Select: + - '0' + - Fn::Split: + - ' ' + - Ref: DBInstanceEngineAndVersion + VpcId: + Ref: Vpc + EngineVersion: + Fn::Select: + - '1' + - Fn::Split: + - ' ' + - Ref: DBInstanceEngineAndVersion + SecurityIPList: + Fn::Join: + - ',' + - - Fn::GetAtt: + - WebServer + - PrivateIp + - Fn::GetAtt: + - EIP + - EipAddress + MasterUsername: + Ref: DBUserName + MasterUserPassword: + Ref: DBPassword + MasterUserType: Super + SecurityGroupIngress: + Type: ALIYUN::ECS::SecurityGroupIngress + Properties: + SourceCidrIp: 0.0.0.0/0 + SecurityGroupId: + Ref: SecurityGroup + IpProtocol: all + PortRange: '-1/-1' + WebServer: + Type: ALIYUN::ECS::Instance + Properties: + IoOptimized: optimized + ImageId: aliyun_3_x64_20G_alibase_20230629.vhd + SecurityGroupId: + Ref: SecurityGroup + Password: + Ref: InstancePassword + InternetMaxBandwidthOut: 80 + UserData: + Fn::Replace: + - ros-notify: + Fn::GetAtt: + - RosWaitConditionHandle + - CurlCli + - Fn::Join: + - '' + - - '#!/bin/sh' + - |+ + + - | + DatabaseUser='wordpressuser' + - | + DatabasePwd='password' + - | + DatabaseName='wordpressdb' + - | + DatabaseHost='localhost' + - | + yum update -y + - | + yum install -y unzip zip + - | + yum install -y mysql-server + - | + systemctl start mysqld + - | + systemctl enable mysqld + - | + mysql -e "CREATE DATABASE wordpressdb;" + - | + mysql -e "CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';" + - | + mysql -e "GRANT ALL PRIVILEGES ON wordpressdb.* TO 'wordpressuser'@'localhost';" + - | + mysql -e "FLUSH PRIVILEGES;" + - | + mysql -e "CREATE USER dtssync1 IDENTIFIED BY 'P@ssw0rd';" + - | + mysql -e "GRANT ALL ON *.* TO 'dtssync1'@'%';" + - | + mysql -e "FLUSH PRIVILEGES;" + - | + mysql -e "SET GLOBAL binlog_format = 'ROW';" + - | + yum install -y nginx + - | + systemctl start nginx + - | + systemctl enable nginx + - | + yum install -y php php-fpm php-mysqlnd + - | + systemctl start php-fpm + - | + systemctl enable php-fpm + - | + cd /usr/share/nginx/html + - | + wget http://wordpress.org/latest.tar.gz + - | + tar xzvf latest.tar.gz + - | + cp -R wordpress/* . + - | + rm -R wordpress + - | + rm -R wordpress + - | + cp wp-config-sample.php wp-config.php + - | + sed -i "s/database_name_here/$DatabaseName/" wp-config.php + - | + sed -i "s/username_here/$DatabaseUser/" wp-config.php + - | + sed -i "s/password_here/${DatabasePwd:-$DatabasePwdDef}/" wp-config.php + - | + sed -i "s/localhost/$DatabaseHost/" wp-config.php + - | + systemctl restart nginx + - | + systemctl restart php-fpm + - | + ros-notify + VSwitchId: + Ref: VSwitch + VpcId: + Ref: Vpc + InstanceType: ecs.g6.large + SystemDiskCategory: cloud_efficiency + AllocatePublicIP: false + EIP: + Type: ALIYUN::VPC::EIP + Properties: + Bandwidth: 50 + InstanceChargeType: Postpaid + InternetChargeType: PayByTraffic + EIPAssociation: + Type: ALIYUN::VPC::EIPAssociation + Properties: + InstanceId: + Ref: WebServer + AllocationId: + Ref: EIP + DependsOn: + - WebServer + - EIP +Outputs: + ECSWordPressUrl: + Description: WordPress default address. + Value: + Fn::Join: + - '' + - - http:// + - Fn::GetAtt: + - EIP + - EipAddress + ECSInstanceUser: + Description: Username and password for logging in to ECS instance + Value: + Fn::Join: + - '' + - - 'USERNAME: root ; PASSWORD: ' + - Ref: InstancePassword + WPUserForSQL: + Description: ECS-hosted database username and password for executing SQL + Value: 'USERNAME: wordpressuser ; PASSWORD: password' + WPUserForDTS: + Description: ECS-hosted database username and password for connecting to DTS + Value: 'USERNAME: dtssync1 ; PASSWORD: P@ssw0rd' + RDSUserDTS: + Description: RDS username and password for connecting to DTS + Value: + Fn::Join: + - '' + - - 'USERNAME: ' + - Ref: DBUserName + - ' ' + - 'PASSWORD: ' + - Ref: DBPassword diff --git a/documents/solution/database/migrate-rds-mysql-to-polardb-mysql.yml b/documents/solution/database/migrate-rds-mysql-to-polardb-mysql.yml index d8b66cba..bb7b3648 100644 --- a/documents/solution/database/migrate-rds-mysql-to-polardb-mysql.yml +++ b/documents/solution/database/migrate-rds-mysql-to-polardb-mysql.yml @@ -129,6 +129,8 @@ Resources: Ref: DBInstanceClass DBInstanceNetType: Intranet Category: HighAvailability + SlaveZoneIds: + - Ref: ZoneId DBInstanceStorageType: cloud_essd DBInstanceStorage: Ref: DBInstanceStorage @@ -180,7 +182,6 @@ Resources: SystemDiskCategory: Ref: SystemDiskCategory SystemDiskSize: 40 - SystemDiskPerformanceLevel: PL0 Password: Ref: Password IoOptimized: optimized diff --git a/documents/solution/high-availability-architecture/alb-cross-region-load-balance.yml b/documents/solution/high-availability-architecture/alb-cross-region-load-balance.yml index be8a7b30..537dd371 100644 --- a/documents/solution/high-availability-architecture/alb-cross-region-load-balance.yml +++ b/documents/solution/high-availability-architecture/alb-cross-region-load-balance.yml @@ -31,7 +31,7 @@ Metadata: zh-cn: ECS实例密码配置 en: Ecs Password Configuration TemplateTags: - - acs:technical-solution:network:ALB实现跨地域负载均衡方案 + - acs:technical-solution:network:ALB实现跨地域负载均衡 Workspace: main.tf: |+ locals { @@ -480,7 +480,7 @@ Workspace: } ], "TemplateTags": [ - "acs:technical-solution:network:ALB实现跨地域负载均衡方案" + "acs:technical-solution:network:ALB实现跨地域负载均衡" ] } } @@ -611,7 +611,7 @@ Workspace: security_groups = alicloud_security_group.group[0].*.id instance_type = var.instance_type system_disk_category = var.system_disk_category - image_id = "centos_7_9_x64_20G_alibase_20220824.vhd" + image_id = "aliyun_3_x64_20G_alibase_20230727.vhd" instance_name = var.instance_name vswitch_id = var.vsw_id password = var.ecs_password diff --git a/documents/solution/micro/mse-end-to-end-canary-release-for-ack-application.yml b/documents/solution/micro/mse-realizes-full-link-grayscale.yml similarity index 97% rename from documents/solution/micro/mse-end-to-end-canary-release-for-ack-application.yml rename to documents/solution/micro/mse-realizes-full-link-grayscale.yml index aed3d3d4..223d05d2 100644 --- a/documents/solution/micro/mse-end-to-end-canary-release-for-ack-application.yml +++ b/documents/solution/micro/mse-realizes-full-link-grayscale.yml @@ -140,8 +140,18 @@ Resources: Name: Ref: MseMicroRegistryInstance Source: MSE + NatGateway: + Type: ALIYUN::VPC::NatGateway + Properties: + ZoneId: + Ref: ZoneId + VpcId: + Ref: Vpc + VSwitchId: + Ref: VSwitch ManagedKubernetesCluster: Type: ALIYUN::CS::ManagedKubernetesCluster + DependsOn: NatGateway Properties: VpcId: Ref: Vpc diff --git a/documents/solution/network/two-region-three-center-high-availability.yml b/documents/solution/network/two-region-three-center-high-availability.yml index a6f3603f..09d94aa4 100644 --- a/documents/solution/network/two-region-three-center-high-availability.yml +++ b/documents/solution/network/two-region-three-center-high-availability.yml @@ -686,7 +686,7 @@ Workspace: security_groups = alicloud_security_group.group.*.id instance_type = var.instance_type system_disk_category = var.system_disk_category - image_id = "centos_7_9_x64_20G_alibase_20220824.vhd" + image_id = "aliyun_3_x64_20G_alibase_20230727.vhd" instance_name = var.instance_name vswitch_id = var.vsw_id password = var.ecs_password diff --git a/documents/solution/storage/snapshot-optimize.yml b/documents/solution/storage/snapshot-optimize.yml new file mode 100644 index 00000000..f2e42057 --- /dev/null +++ b/documents/solution/storage/snapshot-optimize.yml @@ -0,0 +1,305 @@ +ROSTemplateFormatVersion: '2015-09-01' +Description: + zh-cn: 无代理ECS备份高效环境搭建 + en: Deploy high-performance MySQL services based on EBS ESSD. +Parameters: + ecsType: + Default: ecs.g6.large + AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType' + AssociationPropertyMetadata: + SystemDiskCategory: cloud_essd + InstanceChargeType: PostPaid + ZoneId: '${zoneId}' + Type: String + Label: + zh-cn: ECS 实例规格 + en: InstanceType + ecsPassword: + Type: String + Description: + zh-cn: >- + 服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ + 中的特殊符号) + en: >- + Server login password, Length 8-30, must contain three(Capital letters, + lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special + symbol in) + Default: null + MinLength: 8 + Label: + zh-cn: 实例密码 + en: Instance Password + AllowedPattern: '^[a-zA-Z0-9-\(\)\`\~\!\@\#\$\%\^\&\*\_\-\+\=\|\{\}\[\]\:\;\<\>\,\.\?\/]*$' + MaxLength: 30 + AssociationProperty: 'ALIYUN::ECS::Instance::Password' + ConstraintDescription: + zh-cn: '长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/ 中的特殊符号)' + en: >- + Length 8-30, must contain three(Capital letters, lowercase letters, + numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in) + zoneId: + Default: '' + AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId' + Type: String + Label: + zh-cn: 可用区 + en: Availability Zone +Outputs: + EcsLoginAddress: + Description: + zh-cn: Ecs登陆地址。 + en: Ecs login address. + Value: + 'Fn::Sub': + - >- + https://ecs-workbench.aliyun.com/?from=EcsConsole&instanceType=ecs®ionId=${Region}&instanceId=${InstanceId} + - InstanceId: + Ref: EcsInstance + Region: + Ref: 'ALIYUN::Region' + EcsCloneLoginAddress: + Description: + zh-cn: Ecs(克隆)登陆地址。 + en: Ecs clone login address. + Value: + 'Fn::Sub': + - >- + https://ecs-workbench.aliyun.com/?from=EcsConsole&instanceType=ecs®ionId=${Region}&instanceId=${InstanceId} + - InstanceId: + Ref: EcsInstanceClone + Region: + Ref: 'ALIYUN::Region' + EcsInstanceId: + Description: ECS实例ID + Value: + 'Fn::GetAtt': + - EcsInstance + - InstanceId + EcsInstanceUser: + Description: ECS实例初始用户 + Value: root + EcsInstancePublicIp: + Description: ECS实例公网IP + Value: + 'Fn::GetAtt': + - EcsInstance + - PublicIp + MysqlUser: + Description: MySQL初始用户 + Value: root + MysqlPassword: + Description: MySQL初始密码 + Value: 请登录ECS执行以下命令获取初始密码:sudo grep 'temporary password' /var/log/mysqld.log + SystemDiskId: + Description: 系统盘ID + Value: + 'Fn::GetAtt': + - SysTemDisk + - DiskIds +Resources: + SecurityGroup: + Type: 'ALIYUN::ECS::SecurityGroup' + Properties: + SecurityGroupIngress: + - Priority: 1 + PortRange: '-1/-1' + NicType: intranet + SourceCidrIp: 0.0.0.0/0 + IpProtocol: all + VpcId: + Ref: VPC + SecurityGroupEgress: + - Priority: 1 + PortRange: '-1/-1' + DestCidrIp: 0.0.0.0/0 + NicType: intranet + IpProtocol: all + VPC: + Type: 'ALIYUN::ECS::VPC' + Properties: + VpcName: + 'Fn::Join': + - '-' + - - StackId + - Ref: 'ALIYUN::StackId' + CidrBlock: 192.168.0.0/16 + VSwitch: + Type: 'ALIYUN::ECS::VSwitch' + Properties: + VSwitchName: + Ref: 'ALIYUN::StackName' + VpcId: + Ref: VPC + CidrBlock: 192.168.0.0/24 + ZoneId: + Ref: zoneId + EcsInstance: + Type: 'ALIYUN::ECS::Instance' + Properties: + SystemDiskCategory: cloud_essd + VpcId: + Ref: VPC + InternetMaxBandwidthOut: 100 + SecurityGroupId: + Ref: SecurityGroup + SystemDiskSize: 40 + ImageId: centos_7_9_x64_20G_alibase_ + AllocatePublicIP: true + IoOptimized: optimized + InternetChargeType: PayByTraffic + VSwitchId: + Ref: VSwitch + Password: + Ref: ecsPassword + InstanceType: + Ref: ecsType + ZoneId: + Ref: zoneId + InstanceName: + Fn::Sub: ECS_Instance-${ALIYUN::StackId} + RunCommand: + Type: 'ALIYUN::ECS::RunCommand' + Properties: + Type: RunShellScript + CommandContent: + 'Fn::Sub': + - > + #!/bin/sh + + cd /tmp/ + + if wget -N + http://mirrors.cloud.aliyuncs.com/mysql/MySQL-8.0/mysql-8.0.27-1.el7.x86_64.rpm-bundle.tar + -O mysql.tar ; then + + echo "[INFO] Download mysql rpm bundle.tar successfully." + + tar -xf mysql.tar + + echo "[INFO] Extract mysql rpm bundle.tar successfully." + + if yum install -y mysql-community-{server,client,common,libs,devel}-*; then + + echo "[INFO] Install mysql successfully." + + else + + echo "[ERROR] Failed to install mysql." + + exit + + fi + + else + + echo "[ERROR] Failed to download mysql rpm bundle." + + echo "[INFO] Install from [dev.mysql.com rpm repository]" + + rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm + + if yum -y install mysql-community-server --enablerepo=mysql80-community --nogpgcheck; then + + echo "[INFO] Install mysql successfully." + + else + + echo "[ERROR] Failed to install mysql." + + exit + + fi + + fi + + sudo systemctl start mysqld + + sudo systemctl enable mysqld + + sync + - {} + Sync: true + InstanceIds: + - Ref: EcsInstance + Timeout: 600 + DependsOn: + - EcsInstance + SysTemDisk: + Type: 'DATASOURCE::ECS::Disks' + Properties: + InstanceId: + Ref: EcsInstance + DiskType: system + DependsOn: + - RunCommand + SnaptshotPolicy: + Type: 'ALIYUN::ECS::AutoSnapshotPolicy' + Properties: + TimePoints: + - 20 + - 23 + RetentionDays: 1 + RepeatWeekdays: + - 1 + - 2 + DiskIds: + 'Fn::GetAtt': + - SysTemDisk + - DiskIds + AutoSnapshotPolicyName: + Fn::Sub: AutoSnapshotPolicy-${ALIYUN::StackId} + MysqlImage: + Type: 'ALIYUN::ECS::CustomImage' + Properties: + Description: MySQL实例镜像 + InstanceId: + Ref: EcsInstance + ImageName: + Fn::Sub: MySQLImage-${ALIYUN::StackId} + Platform: CentOS + Architecture: x86_64 + DependsOn: + - SnaptshotPolicy + - RunCommand + EcsInstanceClone: + Type: 'ALIYUN::ECS::Instance' + Properties: + SystemDiskCategory: cloud_essd + VpcId: + Ref: VPC + InternetMaxBandwidthOut: 100 + SecurityGroupId: + Ref: SecurityGroup + SystemDiskSize: 40 + ImageId: + 'Fn::GetAtt': + - MysqlImage + - ImageId + AllocatePublicIP: true + IoOptimized: optimized + InternetChargeType: PayByTraffic + VSwitchId: + Ref: VSwitch + Password: + Ref: ecsPassword + InstanceType: + Ref: ecsType + ZoneId: + Ref: zoneId + InstanceName: + Fn::Sub: ECS_Instance_Clone-${ALIYUN::StackId} + DependsOn: + - MysqlImage +Metadata: + 'ALIYUN::ROS::Interface': + ParameterGroups: + - Parameters: + - zoneId + - ecsType + - ecsPassword + - ecsImageId + Label: + zh-cn: 基础配置 + en: Basic Configuration + TemplateTags: + - 'acs:technical-solution:ebs:基于EBS部署高性能的MySQL服务'