选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

查找 Aurora MySQL 主要版本升级失败的原因 - Amazon Aurora

查找 Aurora MySQL 主要版本升级失败的原因

教程中,从 Aurora MySQL 版本 2 升级到版本 3 已获成功。但是,如果升级失败,您会想知道原因。

您可以首先使用 describe-events AWS CLI 命令来查看数据库集群事件。此示例显示过去 10 小时 mydbcluster 的事件。

aws rds describe-events \ --source-type db-cluster \ --source-identifier mydbcluster \ --duration 600

在本例中,我们遇到了升级预检查失败。

{ "Events": [ { "SourceIdentifier": "mydbcluster", "SourceType": "db-cluster", "Message": "Database cluster engine version upgrade started.", "EventCategories": [ "maintenance" ], "Date": "2024-04-11T13:23:22.846000+00:00", "SourceArn": "arn:aws:rds:us-east-1:123456789012:cluster:mydbcluster" }, { "SourceIdentifier": "mydbcluster", "SourceType": "db-cluster", "Message": "Database cluster is in a state that cannot be upgraded: Upgrade prechecks failed. For more details, see the upgrade-prechecks.log file. For more information on troubleshooting the cause of the upgrade failure, see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Upgrading.Troubleshooting.html", "EventCategories": [ "maintenance" ], "Date": "2024-04-11T13:23:24.373000+00:00", "SourceArn": "arn:aws:rds:us-east-1:123456789012:cluster:mydbcluster" } ] }

要诊断问题的确切原因,请检查写入器数据库实例的数据库日志。如果升级到 Aurora MySQL 版本 3 失败,写入器实例将包含一个名为 upgrade-prechecks.log 的日志文件。此示例说明了如何检测该日志是否存在,然后将其下载到本地文件以供检查。

aws rds describe-db-log-files --db-instance-identifier mydbcluster-instance \ --query '*[].[LogFileName]' --output text error/mysql-error-running.log error/mysql-error-running.log.2024-04-11.20 error/mysql-error-running.log.2024-04-11.21 error/mysql-error.log external/mysql-external.log upgrade-prechecks.log aws rds download-db-log-file-portion --db-instance-identifier mydbcluster-instance \ --log-file-name upgrade-prechecks.log \ --starting-token 0 \ --output text >upgrade_prechecks.log

upgrade-prechecks.log 文件为 JSON 格式。我们使用 --output text 选项下载该文件,避免在另一个 JSON 包装器中对 JSON 输出进行编码。对于 Aurora MySQL 版本 3 升级,此日志始终包含某些信息和警告消息。如果升级失败,日志仅包含错误消息。如果升级成功,则根本不会生成日志文件。

要汇总所有错误并显示关联的对象和描述字段,您可以对 upgrade-prechecks.log 文件的内容运行命令 grep -A 2 '"level": "Error"'。这样做会显示每个错误行及其后两行。其中包含相应数据库对象的名称以及有关如何解决问题的指导。

$ cat upgrade-prechecks.log | grep -A 2 '"level": "Error"' "level": "Error", "dbObject": "problematic_upgrade.dangling_fulltext_index", "description": "Table `problematic_upgrade.dangling_fulltext_index` contains dangling FULLTEXT index. Kindly recreate the table before upgrade."

在此示例中,您可以对有问题的表运行以下 SQL 命令来尝试修复问题,也可以重新创建没有悬挂索引的表。

OPTIMIZE TABLE problematic_upgrade.dangling_fulltext_index;

然后重试升级。

隐私网站条款Cookie 首选项
© 2025, Amazon Web Services, Inc. 或其附属公司。保留所有权利。