Updated on 2022-08-17 GMT+08:00

Doubling Shards and Resharding Data Records

Overview

With resharding, physical databases corresponding to the schema are doubled and rebalanced to each DB instance as much as possible. During this process, data records are redistributed.

Prerequisites

  • There are schemas available in a running DDM instance.
  • You have purchased a MySQL DB instance. The DB instance and your DDM instance are in the same VPC, and the DB instance is not in use by other DDM instances.

Procedure

  1. In the instance list, locate the instance that contains schemas you require and click the instance name.
  2. On the displayed page, in the navigation pane, choose Schemas.
  3. In the schema list, locate the schema that you want to scale out and click Scale Out the Operation column.

    Figure 1 Scale Out

  4. On the displayed page, select Reshard for Scaling Method, configure Traffic Switch and Automatic Clearance Required, select the required DB instances, enter the administrator password, and click Test Connection. After the connection is successful, click Next: Confirm Information.

    Figure 2 Reshard
    Figure 3 Reshard

  5. Click Next: Pre-check. After all check items are complete, click Scale out.

    If the schema status changes to Running, the scaling out succeeds and the newly-added MySQL DB instance is displayed in the Associated DB Instance column.

    If the DDM instance version is earlier than 2.4.1.3, do not set sql_mode to ANSI_QUOTES. If you do so, do not use double quotation marks to quote text strings because the quotation marks will be translated into an identifier that makes the quoted string invalid.

    For example, logic in select * from test where tb = "logic" cannot be parsed correctly.

  6. If Status changes to Scaling failed, the schema failed to be scaled out. Click Retry or Roll Back.

    • Scale out a schema during off-peak hours.
    • Storage scaling does not support tables without primary keys.
    • Only schemas whose status is Running can be scaled out.
    • Only one schema can be scaled out in a DDM instance at a time.
    • A maximum of 256 MySQL DB instances can be selected for scaling.
    • You can view the scaling progress on the Schemas page. The whole scaling process takes about 5 to 30 minutes depending on the amount of data to be migrated.
    • During scaling, DDM automatically enables the LOAD DATA function. After scaling, you can disable the function in parameter template settings of the MySQL DB instance as needed.