This topic describes how to convert the storage engine of DRDS from InnoDB to X-Engine.
Most users of existing ApsaraDB for RDS instances want to use X-Engine. These users have the following characteristics:
- Most RDS instances run MySQL 5.6 or MySQL 5.7. Few RDS instances run MySQL 8.0.
- A single instance has a large volume of data, which reaches the upper limit of disk space supported by the instance type. For example, an RDS instance with 4 CPU cores and 8 GB of memory supports up to 2 TB of local SSDs.
- The users also use DRDS. In addition, some users use an old version of DRDS and have customized functions, such as SQL passthrough.
To address the user requirements, Alibaba Cloud allows you to convert the storage engine of DRDS from InnoDB to X-Engine by following the procedure in this topic.
RDS for MySQL 8.0 instances provide consistent API operations and user experience regardless of whether they use InnoDB or X-Engine. In this situation, after a DRDS upgrade, we recommend that you convert the storage engines for the RDS instances from InnoDB to X-Engine one by one. For example, if a DRDS instance has eight RDS instances, first convert the storage engine for one of the eight RDS instances. Monitor the instance running for a period of time. If you confirm that no compatibility or performance issues occur, convert the storage engines for the remaining seven RDS instances.
Compression ratio verification before conversion
Before conversion, we recommend that you purchase an RDS instance that is powered by X-Engine with the same specifications as the existing RDS instance that is powered by the InnoDB storage engine. Then, you can use Alibaba Cloud Data Transmission Service (DTS) to import data from the existing RDS instance to the purchased instance. This way, you can check the compression efficiency. The compression efficiency allows you to determine the following items:
- Instance storage capacity
Based on the compression efficiency, you can determine the instance specifications that you need to purchase after you convert a storage engine from InnoDB to X-Engine. For example, if the space required after compression is below 30% of the original space, you can purchase an RDS instance with 1 TB of disk space after you convert the storage engine of an RDS instance that originally requires 3 TB of disk space. Alternatively, you can purchase an RDS instance with the same specifications to reserve storage space for future business development.
- Number of database shards
After storage space is reduced, you can reduce the number of database shards. For example, you can merge databases that are distributed across instances to one instance. This reduces costs.
- Upgrade DRDS to a version later than V5.4.2-15744202.
- If the DRDS version is later than v5.4.2-15744202, skip this step.
- To ensure compatibility, you must adjust the service code. This applies if your business is based on specific API operations that are provided in an earlier version of DRDS, for example, the SQL passthrough function for performance optimization.
- Select an RDS instance with the InnoDB storage engine from DRDS as the first instance
for conversion. Export table creation statements and change the engine type to X-Engine.
Then, create an RDS instance with the target specifications and X-Engine. Alternatively,
use the RDS instance that you created when you verify the compression efficiency and
import the table structure scripts into this instance.
Note If you use DTS to migrate data, the engine type of the source instance is inherited by default. You must separately export the table creation statements and change the engine type to X-Engine before you can migrate data to the destination instance that is powered by X-Engine.
- For more information about how to create an RDS instance, see Create an ApsaraDB RDS for MySQL instance.
- For more information about how to import and export table creation statements, see Convert the storage engine from InnoDB, TokuDB, or MyRocks to X-Engine.
- Use DTS to synchronize data from the RDS instance with the InnoDB storage engine to
the RDS instance with X-Engine. For more information about data synchronization, see
Configure two-way data synchronization between ApsaraDB RDS for MySQL instances.
Note You can use the two-way synchronization function of DTS to ensure data consistency between the two RDS instances.
- Modify DRDS routing rules and redirect the access requests to the RDS instance with
the InnoDB storage engine to the RDS instance with X-Engine. If you want to modify
the DRDS routing rules, submit a ticket.
Note Run the first RDS instance with X-Engine for five days. Monitor the instance running and consider the request processing time, exception information, and two-way synchronization progress. If an exception occurs, you must make sure that services can be switched back to the original RDS instance with the InnoDB storage engine. For more information, see View resource and engine monitoring data.
- After you confirm that the first RDS instance with X-Engine is running as normal,
proceed with the conversion for 30% to 50% of the remaining RDS instances and then
monitor the instance running for three to five days. In this case, repeat the preceding
steps 2 to 4.
Note Do not release or bring the original RDS instances with InnoDB offline because these instances are required to perform DTS two-way synchronization with new RDS instances with X-Engine.
- Perform the conversion for all the remaining RDS instances. After you complete the conversion for all the instances of DRDS, monitor the instance running for three to five days. If the new instances run as normal, release all DTS synchronization links and the original RDS instances with InnoDB.