How do I perform an Amazon RDS for MySQL version upgrade?

5 minutos de lectura
1

I want to upgrade my Amazon Relational Database Service (Amazon RDS) for MySQL version. I want to know how to perform the upgrade and what factors affect the upgrade time.

Resolution

Performing an Amazon RDS for MySQL version upgrade

To manually upgrade the engine version of a RDS DB instance, use the AWS Management Console, AWS Command Line Interface (AWS CLI), or Amazon RDS API.

Note: If you receive errors when running an AWS CLI command, make sure that you're using the most recent version of the AWS CLI.

For an overview of the upgrade process, see Upgrading the RDS for MySQL DB engine.

Amazon RDS for MySQL upgrade time

The duration of the upgrade process depends on the upgrade type, data, and available resources. It's a best practice to first test the upgrades on separate test instances to understand the approximate upgrade duration. You can also use a snapshot restore or read replica to launch test instances for the major or minor upgrade. For more information about major and minor version upgrades, see Major version upgrades for RDS for MySQL and Automatic minor version upgrades for RDS for MySQL.

Tip: To minimize the upgrade downtime, use blue/green deployment for database updates

Factors that can affect the upgrade time

All version upgrades

When backups are turned on, Amazon RDS takes a snapshot when the instance is still running on the previous version. If Amazon RDS doesn't find any recent backups, then Amazon RDS takes a full snapshot during the upgrade process. The size of your changes determines how long it takes for the upgrade to complete. However, your instance can continue to accept traffic when Amazon RDS takes the snapshot.

After a backup completes, the instance shuts down. Then, MySQL runs the new engine version on a deactivated network to prevent any remote connections.

Note: If you're performing a major version upgrade, then the shutdown can take longer.

Only major version upgrades

To employ a slow shutdown, Amazon RDS sets the innodb_fast_shutdown parameter value to 0. This mode performs additional flushing, such as merging the change buffer and performing a full purge of deleted rows. Depending on the amount of data that's recovered, the slow shutdown can take minutes or hours. The slow shutdown of a database with a large change buffer or long history list can take longer. 

For more information, see the following documentation on the MySQL website:

The mysql_upgrade program runs on the MySQL database to convert system and user tables to a new version. Depending on the state of your table, you might need to create your table to conform to a new version. In most cases, you don't need to make changes. The mysql_upgrade program updates the metadata in the table to indicate that the database is upgraded. If you have a larger number of tables, then Amazon RDS for MySQL might take longer to complete the major version upgrade. For more information, see mysql_upgrade: check and upgrade MySQL tables on the MySQL website.

During major upgrades to version 5.7, Amazon RDS for MySQL rebuilds some of your tables. All date and time column types convert to the new format. Depending on the amount of data in your tables, the conversion can take several hours to days. For more information, see Upgrades to MySQL version 5.7 might be slow.

MySQL 8.0 includes several incompatibilities with MySQL 5.7. These incompatibilities can cause problems during an upgrade from MySQL 5.7 to MySQL 8.0. For the upgrade to be successful, you might need to prepare your database. For more information, see Prechecks for upgrades from MySQL 5.7 to 8.0.

When you start an upgrade from MySQL 5.7 to 8.0, Amazon RDS automatically runs prechecks to detect these incompatibilities. These prechecks are mandatory. For information, see Upgrading MySQL on the MySQL website.

Note:

  • For an upgrade from MySQL 5.7 to MySQL 8.0, Amazon RDS runs all upgrade prechecks.
  • For an upgrade from MySQL 5.6 to MySQL 5.7, Amazon RDS runs prechecks to confirm that there's enough storage space to rebuild tables. Amazon RDS also runs prechecks to confirm that there aren't orphan tables.
  • Amazon RDS doesn't run prechecks for upgrades to releases earlier than MySQL 5.7.
  • It's a best practice to have a rollback plan in case the major version upgrade fails.
  • To check for issues in your tables, it's a best practice to perform a mysqlcheck. However, table maintenance operations can consume significant time and resources, particularly for large tables. For more information, see mysqlcheck: A table maintenance program on the MySQL website.

Related information

Upgrading a DB instance engine version

Best practices for upgrading Amazon RDS for MySQL and Amazon RDS for MariaDB

MySQL on Amazon RDS versions

OFICIAL DE AWS
OFICIAL DE AWSActualizada hace 7 meses