我创建了一个 Aurora 集群 (postgresql 11),在 ap-southeast-2 区域(1 个写入器,2 个读取器)中有 3 个实例。我注意到作者在 AZ 2b
中,但两个读者在同一个 AZ 中,即 2a
。如何让它们均匀分布到 3 个 AZ?
此集群的 cloudformation:
AuroraDBFirstInstance:
Type: AWS::RDS::DBInstance
Properties:
DBInstanceClass: ${self:custom.postgresqlInstanceClass}
Engine: aurora-postgresql
EngineVersion: ${self:custom.postgresqlEngineVersion}
DBClusterIdentifier: !Ref AuroraDBCluster
PubliclyAccessible: ${self:custom.publiclyAccessible}
AuroraDBSecondInstance:
Type: AWS::RDS::DBInstance
Properties:
DBInstanceClass: ${self:custom.postgresqlInstanceClass}
Engine: aurora-postgresql
EngineVersion: ${self:custom.postgresqlEngineVersion}
DBClusterIdentifier: !Ref AuroraDBCluster
PubliclyAccessible: ${self:custom.publiclyAccessible}
AuroraDBThirdInstance:
Type: AWS::RDS::DBInstance
Properties:
DBInstanceClass: ${self:custom.postgresqlInstanceClass}
Engine: aurora-postgresql
EngineVersion: ${self:custom.postgresqlEngineVersion}
DBClusterIdentifier: !Ref AuroraDBCluster
PubliclyAccessible: ${self:custom.publiclyAccessible}
答案 0 :(得分:0)
您可以自行在 cloudformation 中指定可用区。如果您不指定子网,则 Aurora 将从您提供的子网组中随机选择可用区。
Type: AWS::RDS::DBInstance
Properties:
AllocatedStorage: String
AllowMajorVersionUpgrade: Boolean
AssociatedRoles:
- DBInstanceRole
AutoMinorVersionUpgrade: Boolean
AvailabilityZone: String
BackupRetentionPeriod: Integer
CACertificateIdentifier: String
CharacterSetName: String
CopyTagsToSnapshot: Boolean
DBClusterIdentifier: String
DBInstanceClass: String
DBInstanceIdentifier: String
DBName: String
DBParameterGroupName: String
DBSecurityGroups:
- String
DBSnapshotIdentifier: String
DBSubnetGroupName: String
DeleteAutomatedBackups: Boolean
DeletionProtection: Boolean
Domain: String
DomainIAMRoleName: String
EnableCloudwatchLogsExports:
- String
EnableIAMDatabaseAuthentication: Boolean
EnablePerformanceInsights: Boolean
Engine: String
EngineVersion: String
Iops: Integer
KmsKeyId: String
LicenseModel: String
MasterUsername: String
MasterUserPassword: String
MaxAllocatedStorage: Integer
MonitoringInterval: Integer
MonitoringRoleArn: String
MultiAZ: Boolean
OptionGroupName: String
PerformanceInsightsKMSKeyId: String
PerformanceInsightsRetentionPeriod: Integer
Port: String
PreferredBackupWindow: String
PreferredMaintenanceWindow: String
ProcessorFeatures:
- ProcessorFeature
PromotionTier: Integer
PubliclyAccessible: Boolean
SourceDBInstanceIdentifier: String
SourceRegion: String
StorageEncrypted: Boolean
StorageType: String
Tags:
- Tag
Timezone: String
UseDefaultProcessorFeatures: Boolean
VPCSecurityGroups:
- String
有关每个属性的更好信息,您可以参考 cloudformation 模板文档。 https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html
答案 1 :(得分:0)
您可以通过 DBSubnetGroup 和 AvailabilityZone 控制数据库实例的放置。
以下是用于创建 DBSubnetGroup
的工作示例,该示例由 us-east-1
中 3 个不同可用区中的 3 个子网组成。要运行此示例,您唯一需要做的就是将 us-east-1a
、us-east-1b
、us-east-1c
AZ 中的子网 ID 更改为您自己的子网 ID }}:
MyDBSubnetGroup