Assuming no Slaves, 8.0, no Triggers, and a few other things, I would recommend
pt-online-schema-change
It will CREATE TABLE
with the new schema (utf8mb4), then copy the rows from the existing table (utf8 aka utf8mb3), and use Triggers to keep things in sync. There is a brief lock on the table at the end to finish up and swap tables.
You would do that one table at a time.
Doc: https://www.percona.com/doc/percona-toolkit/LATEST/pt-online-schema-change.html
Also search around for it; sometimes abbreviated pt-osc
.
With a Slave
Investigate the "failover" options and speed with RDS. If you can control the failover, then this method may be fast and 'simple' and possible. I assume it is really Master-Slave, not Master-Master?
- With the Slave, leave it replicating from the Master. (Potential problem: RBR may squawk at utf8 replicating to utf8mb4. This needs investigating.)
- Do
ALTER TABLE ... CONVERT TO ...
for each table on the Slave.
- Failover.
- Depending on what tools RDS has, it may be better to rebuild the Slave(s) from the new Master instead of doing
ALTERs
on the new Slave (which is the old Master).
Suggest you spin up some tiny instances with the same Master-Slave topology and version and charsets. Then try the steps. It does not need may rows, but it does need FOREIGN KEYs
, Triggers, etc, in case any of them cause trouble. (Note how pt-osc has some issues with FKs.)