跳至内容

如何解决 Amazon RDS for MySQL 数据库实例中的升级前检查失败问题?

3 分钟阅读
0

我想解决我在尝试升级 Amazon Relational Database Service(Amazon RDS)for MySQL 数据库实例时遇到的升级前检查失败问题。

简短描述

Amazon RDS 和 Amazon Aurora MySQL 兼容版具有自动预检查功能,可最大限度地减少版本升级期间的计划外停机时间。当您从 MySQL 版本 5.7 升级到 8.0 或从 8.0 升级到 8.4 时,预检查会检测到任何可能影响升级的数据不兼容性。当数据库实例的升级前检查失败时,Amazon RDS for MySQL 版本升级将停止。然后,Amazon RDS 会在 PrePatchCompatibility 日志文件中提供预检查失败的详细信息。

要识别和更正问题,请查看 Aurora 和 RDS 控制台中 Logs & events(日志和事件)下的日志文件。

有关 MySQL 预检查的信息,请参阅 MySQL 网站上的 Upgrade checker utility(升级检查器实用程序)。

解决方法

注意: 如果在运行 AWS 命令行界面(AWS CLI)命令时遇到错误,请参阅排查 AWS CLI 错误。此外,请确保您使用的是最新版本的 AWS CLI。

查看升级前检查失败消息

要查看您的日志文件,请完成以下步骤:

  1. 打开 Aurora 和 RDS 控制台。
  2. 在导航窗格中,选择 Databases(数据库),然后选择要升级的数据库。
  3. 选择 Logs & events(日志和事件)选项卡,然后在 Recent events(最近的事件)中搜索 PrePatchCompatibility。
  4. 查看 PrePatchCompatibility 日志文件,然后解决问题。
    注意: 在大多数情况下,日志条目包含指向有关如何纠正不兼容问题的 Amazon RDS for MySQL 文档的链接。

查看消息中是否有针对特定错误、警告和通知的消息

在 PrePatchCompatibility 日志文件中,您可能会收到以下预检查消息之一:

  • "Usage of old temporal type : ERROR"
  • "Usage of db objects with names conflicting with new reserved keywords : WARNING"
  • "Usage of utf8mb3 charset : NOTICE"
  • "Table names in the mysql schema conflicting with new tables in 8.0 : ERROR"
  • "Partitioned tables using engines with non native partitioning : ERROR"
  • "Foreign key constraint names longer than 64 characters : ERROR"
  • "Usage of obsolete MAXDB sql_mode flag : WARNING"
  • "Usage of obsolete sql_mode flags : NOTICE"
  • "ENUM/SET column definitions containing elements longer than 255 characters : ERROR"
  • "Usage of partitioned tables in shared tablespaces : ERROR"
  • "Circular directory references in tablespace data file paths : ERROR"
  • "Usage of removed functions : ERROR"
  • "Usage of removed GROUP BY ASC/DESC syntax : ERROR"
  • "Removed system variables for error logging to the system log configuration : ERROR"
  • "Removed system variables : ERROR"
  • "System variables with new default values : WARNING"
  • "Schema inconsistencies resulting from file removal or corruption : ERROR"
  • "Issues reported by 'check table x for upgrade' command : ERROR or WARNING or NOTICE"
  • "The definer column for mysql.events cannot be null or blank. : ERROR"
  • "Tables with dangling FULLTEXT index reference : ERROR"
  • "Routines with deprecated keywords in definition : ERROR"
  • "DB instance must have enough free disk space : ERROR"
  • "Creating indexes larger than 767 bytes on tables with redundant row format might cause the tables to be inaccessible. : WARNING"
  • "The tables with redundant row format can't have an index larger than 767 bytes. : ERROR"
  • "Column definition mismatch between InnoDB Data Dictionary and actual table definition. : ERROR"

如果您收到 ERROR 消息,请在尝试升级之前更正错误。如果您收到 WARNING 消息,则表示 Amazon RDS 未发现任何致命错误,但确实已发现一些潜在的问题。

如果您收到 NOTICE 消息,则表示 Amazon RDS 未发现任何已知的兼容性错误或问题。但是,请查看错误日志中的 NOTICE。

列出日志文件并下载数据

要列出日志文件并下载数据,请完成以下步骤:

  1. 运行 describe-db-log-files AWS CLI 命令,以列出日志文件:

    aws rds describe-db-log-files \
        --db-instance-identifier DB_identifier \
        --query '*[].[LogFileName]' \
        --output text

    注意: 将 DB_identifier 替换为日志文件所在数据库的名称。
    示例输出:

    PrePatchCompatibility.log
    error/mysql-error.log
    error/mysql-error-running.log
    error/mysql-error-running.log.2023-05-06.3
    error/mysql-error-running.log.2023-05-09.4
    error/mysql-error-running.log.2023-05-10.3
    error/mysql-error-running.log.2023-05-12.19
    mysqlUpgrade
  2. 运行 download-db-log-file-portion 命令,以下载特定的日志文件:

    aws rds download-db-log-file-portion \
        --db-instance-identifier DB_identifier \
        --log-file-name PrePatchCompatibility.log \
        --starting-token 0 \
        --output text > LogFileName

    注意: 将 DB_identifier 替换为日志文件所在数据库的名称。将 LogFileName 替换为文件名,以保存副本。
    示例输出:

    aws rds download-db-log-file-portion \
        --db-instance-identifier testinstance \
        --log-file-name PrePatchCompatibility.log \
        --starting-token 0 \
        --output text > PrePatchCompatibilityCopy.log

相关信息

MySQL 网站上的 Upgrading to MySQL 8.0? Here's what you need to know(要升级到 MySQL 8.0?以下是您需要了解的内容)

MySQL 网站上的 Preparing your installation for upgrade(为升级做好安装准备)

AWS 官方已更新 1 年前