打开和关闭 Performance Insights
您可以在创建数据库集群时,为其打开 Performance Insights。如果需要,您可以稍后在实例级别为数据库集群中的任何实例关闭它。打开和关闭 Performance Insights 不会导致停机、重启或故障转移。
注意
性能架构是 Aurora MySQL 使用的一个可选性能工具。如果打开或关闭性能架构,则需要重新启动。但是,如果您打开或关闭性能详情,则无需重新启动。有关更多信息,请参阅为 Aurora MySQL 上的 Performance Insights 启用 Performance Schema。
如果将 Performance Insights 与 Aurora Global Database 一起使用,则分别为每个 Amazon Web Services 区域 中的数据库实例打开 Performance Insights。有关详细信息,请参阅 使用 Amazon RDS 性能详情监控 Amazon Aurora Global Database。
Performance Insights 代理占用数据库主机上有限的 CPU 和内存。当数据库负载较高时,代理将通过降低收集数据的频率来限制性能影响。
在控制台中,您可以在创建数据库集群时打开或关闭性能详情。您可以修改集群中的数据库实例,为该实例打开或关闭性能详情。
创建数据库集群时打开或关闭 Performance Insights
在创建新数据库集群时,通过在 Performance Insights 部分中选择 Enable Performance Insights(启用 Performance Insights)打开 Performance Insights。或选择禁用 Performance Insights。要创建数据库集群,请按照创建 Amazon Aurora 数据库集群中数据库引擎的说明操作。
以下屏幕截图显示了 Performance Insights 部分。
如果您选择启用 Performance Insights,您有以下选项:
-
保留 – 保留 Performance Insights 数据的时间。免费套餐中的保留设置为 Default (7 days) [原定设置(7 天)]。要将性能数据保留更长时间,请指定 1–24 个月。有关保留期的更多信息,请参阅性能详情的定价和数据留存。
-
Amazon KMS key - 指定您的 Amazon KMS key。Performance Insights 使用您的 KMS 密钥来加密所有潜在的敏感数据。正在传输的数据和静态数据都会被加密。有关更多信息,请参阅为 Performance Insights 配置 Amazon KMS 策略。
修改数据库集群数据库实例时打开或关闭 Performance Insights
在控制台中,您可以修改数据库集群数据库实例以打开或关闭 Performance Insights。您无法在集群级别打开或关闭 Performance Insights:必须为集群中的每个实例执行此操作。
使用控制台为或多可用区数据库集群中的数据库实例打开或关闭 Performance Insights
登录 Amazon Web Services Management Console 并通过以下网址打开 Amazon RDS 控制台:https://console.aws.amazon.com/rds/
。 -
选择数据库。
-
选择数据库实例,然后选择 Modify(修改)。
-
在 Performance Insights 部分,选择启用 Performance Insights 或禁用 Performance Insights。
如果您选择启用 Performance Insights,您有以下选项:
-
保留 – 保留 Performance Insights 数据的时间。免费套餐中的保留设置为 Default (7 days) [原定设置(7 天)]。要将性能数据保留更长时间,请指定 1–24 个月。有关保留期的更多信息,请参阅性能详情的定价和数据留存。
-
Amazon KMS key - 指定您的 KMS 密钥。Performance Insights 使用您的 KMS 密钥来加密所有潜在的敏感数据。正在传输的数据和静态数据都会被加密。有关更多信息,请参阅“加密 Amazon Aurora 资源”。
-
-
选择继续。
-
对于 Scheduling of Modifications(修改计划),请选择“Apply immediately”(立即应用)。如果您选择“Apply during the next scheduled maintenance window”(在下一个计划的维护时段内应用),则您的实例将忽略此设置并立即打开 Performance Insights。
-
选择修改实例。
使用 create-db-instance Amazon CLI 命令时,通过指定 --enable-performance-insights
可打开 Performance Insights。或者通过指定 --no-enable-performance-insights
以关闭 Performance Insights。
您还可以使用以下 Amazon CLI 命令指定这些值:
以下过程介绍了如何使用 Amazon CLI 为数据库集群中的现有数据库实例打开或关闭 Performance Insights。
使用 Amazon CLI 为数据库集群中的数据库实例打开或关闭 Performance Insights
-
调用 modify-db-instance Amazon CLI 命令并提供以下值:
-
--db-instance-identifier
– 数据库集群中的数据库实例的名称。 -
--enable-performance-insights
以打开或--no-enable-performance-insights
以关闭
以下示例为
sample-db-instance
打开 Performance Insights。对于 Linux、macOS 或 Unix:
aws rds modify-db-instance \ --db-instance-identifier sample-db-instance \ --enable-performance-insights
对于 Windows:
aws rds modify-db-instance ^ --db-instance-identifier sample-db-instance ^ --enable-performance-insights
-
在 CLI 中打开性能详情时,可以选择通过 --performance-insights-retention-period
选项指定保留性能详情数据的天数。您可以指定 7
、month
* 31(其中 month
为 1–23 之间的数字)或 731
。例如,如果您想将性能数据保留 3 个月,请指定 93
,也就是 3 * 31。原定设置值为 7
天。有关保留期的更多信息,请参阅性能详情的定价和数据留存。
以下示例为 sample-db-instance
开启性能详情并指定将性能详情数据保留 93 天(3 个月)。
对于 Linux、macOS 或 Unix:
aws rds modify-db-instance \ --db-instance-identifier sample-db-instance \ --enable-performance-insights \ --performance-insights-retention-period 93
对于 Windows:
aws rds modify-db-instance ^ --db-instance-identifier sample-db-instance ^ --enable-performance-insights ^ --performance-insights-retention-period 93
如果您指定保留期(如 94 天),这不是一个有效值,则 RDS 会发出错误。
An error occurred (InvalidParameterValue) when calling the CreateDBInstance operation: Invalid Performance Insights retention period. Valid values are: [7, 31, 62, 93, 124, 155, 186, 217, 248, 279, 310, 341, 372, 403, 434, 465, 496, 527, 558, 589, 620, 651, 682, 713, 731]
在使用 CreateDBInstance 操作 Amazon RDS API 操作在数据库集群中创建新数据库实例时,通过将 EnablePerformanceInsights
设置为 True
来打开 Performance Insights。要关闭 Performance Insights,请将 EnablePerformanceInsights
设置为 False
。
您还可以使用以下 API 操作指定 EnablePerformanceInsights
值:
在打开 Performance Insights 时,可以通过 PerformanceInsightsRetentionPeriod
参数指定 Performance Insights 数据的保留时间,以天为单位。您可以指定 7
、month
* 31(其中 month
为 1–23 之间的数字)或 731
。例如,如果您想将性能数据保留 3 个月,请指定 93
,也就是 3 * 31。原定设置值为 7
天。有关保留期的更多信息,请参阅性能详情的定价和数据留存。