This topic describes how to convert the storage engine of DRDS from InnoDB to X-Engine.
Background information
A large number of users want to use X-Engine as the storage engine of their existing ApsaraDB RDS instances. The following list describes the characteristics of these users and their existing RDS instances:
- Most RDS instances run MySQL 5.6 or MySQL 5.7. Few RDS instances run MySQL 8.0.
- A single RDS instance has a large volume of data, which reaches the upper limit of the disk space supported by the instance type. For example, an RDS instance with 4 CPU cores and 8 GB of memory supports local disks of up to 2 TB.
- Most users use DRDS . In addition, some of them use DRDS of earlier versions or with custom features such as SQL passthrough.
To meet 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. DRDS
Conversion plan
RDS instances that run MySQL 8.0 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 RDS instance for a period of time. If no compatibility or performance issues occur, convert the storage engines for the remaining seven RDS instances.
Compression efficiency verification before the conversion
Before you convert the storage engine of an RDS instance, we recommend that you purchase an RDS instance that is powered by X-Engine with the same instance type as the existing RDS instance that is powered by InnoDB. Then, you can use Alibaba Cloud Data Transmission Service (DTS) to import data from the existing RDS instance to the purchased RDS 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 type that you need to purchase after you convert a storage engine from InnoDB to X-Engine. For example, if the storage capacity required after the compression is below 30% of the original storage capacity, 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 instance type to reserve storage capacity for future business development.
- Number of database shards
After the storage capacity of an RDS instance is reduced, you can reduce the number of database shards. For example, you can merge databases that are distributed across RDS instances to one RDS instance. This reduces costs.
Conversion procedure
- Upgrade
DRDS
to a version later than V5.4.2-15744202. Note
- This section uses PolarDB-X 1.0 as an example.
- If the DRDS version is later than v5.4.2-15744202, skip this step.
- To ensure the compatibility, you must modify the code. This applies if your business is based on specific API operations that are provided in an earlier version of DRDS. For example, if the SQL passthrough feature for performance optimization is used, you must modify the code.
- 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 required instance type and the X-Engine storage engine. Alternatively, use the RDS instance that you created when you verify the compression efficiency and import the table structure scripts into this instance.
- 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.
Note When you use DTS to migrate data from the existing RDS instance to a new RDS instance, the new RDS instance inherits the storage engine of the existing RDS instance 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 new RDS instance that is powered by X-Engine. - Use DTS to synchronize data from the RDS instance with the InnoDB storage engine to the RDS instance with the X-Engine storage engine. For more information about data synchronization, see Configure two-way synchronization between MySQL databases. Note You can use the two-way synchronization feature 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 the X-Engine storage engine. Note Run the first RDS instance with the X-Engine storage engine for five days. Monitor the instance and consider the request processing time, exception information, and two-way synchronization progress. If an exception occurs, you must make sure that your workloads can be switched back to the original RDS instance with the InnoDB storage engine. For more information, see View the metrics of an ApsaraDB RDS for MySQL instance.
- After you confirm that the first RDS instance with the X-Engine storage engine is running as expected, proceed with the conversion for 30% to 50% of the remaining RDS instances and then monitor the instance 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 the InnoDB storage engine offline because these instances are required to implement two-way synchronization with the new RDS instances with the X-Engine storage engine. DTS provides the two-way synchronization feature.
- Perform the conversion for all the remaining RDS instances. After you complete the conversion for all the RDS instances of DRDS, monitor the instances for three to five days. If the new RDS instances run as expected, release all DTS synchronization links and the original RDS instances with the InnoDB storage engine.