You can build a replication relationship between an ApsaraDB for MyBase instance of the Basic Edition and a user-created MySQL instance based on Elastic Compute Service (ECS) by running the change master to command. This topic describes the related mechanisms and procedures.

Prerequisites

  • A MyBase for MySQL dedicated cluster of the Enterprise Edition or Basic Edition is created. For more information, see Create a dedicated cluster.
  • A host is purchased. For more information, see Create hosts.
  • An instance of the Basic Edition is created. For more information, see Create a MyBase for MySQL instance.
  • A privileged account is used to log on to the ApsaraDB for MyBase instance. For more information, see Step 5 in the following procedure.

Background information

The primary/secondary synchronization mechanism allows you to simultaneously replicate data from one database server to multiple database servers. To replicate data, specify one database server as the primary server and other database servers as secondary servers. The data is replicated in an asynchronous way. Therefore, you do not need to keep the secondary servers connected to the primary server. Data can be replicated through intermittent dial-up connections between the primary server and secondary servers. You can specify the content to be replicated in a configuration file. For example, you can replicate the data of all databases, a specified database, or a table in a specified database. When you configure replication between primary and secondary MySQL database servers, you must run the change master to command on secondary servers to ensure that the information of the primary server is valid. The primary server information includes the IP address, username, password, binary log files, and the location of the binary log files. You can connect to an ApsaraDB for MyBase instance from your ECS instance by using the internal endpoint. Then, you can build a replication relationship between the two instances by running the change master to command. After you perform these operations, the ApsaraDB for MyBase instance functions as a secondary server of the user-created MySQL instance. This reduces the workloads of the user-created MySQL instance.

Procedure

  1. Log on to the ApsaraDB for MyBase console.
  2. In the upper-left corner of the page, select the region where you want to deploy the dedicated cluster.
    Select a region
  3. Find the dedicated cluster that you want to manage, and click Details in the Actions column.
  4. On the Dedicated Cluster information page, click Instances in the left-side navigation pane. On the Instances page, find the instance that you want to connect to and click Details.
  5. In the left-side navigation pane of the page that shows instance details, click Accounts. On the Accounts tab, click Create Account. Specify Database Account and Password, set Account Type to Privileged Account, and then click Create.
    Note
    • To build a replication relationship between an ApsaraDB for MyBase instance and an ECS-based MySQL instance, use the privileged account to log on to the ApsaraDB for MyBase instance and then run the change master to command.
    • On the Data Security page, you can click Create Whitelist on the Whitelist Settings tab or click Add Security Group on the Security Group tab to enhance database security. For more information, see Configure an IP address whitelist for an ApsaraDB RDS for MySQL instance.
  6. Return to the page that shows instance details. In the left-side navigation pane, click Database Connection. On the Database Connection page, copy the string in Internal Endpoint.
  7. Use the internal endpoint to connect to the ApsaraDB for MyBase instance from your ECS instance.
    Note For more information about how to connect an ECS instance to another instance, see Connect to an ApsaraDB RDS for MySQL instance.
  8. Run the change master to command to build a replication relationship between the ApsaraDB for MyBase instance and the ECS-based user-created MySQL instance.
    Note
    • Your ECS instance and the ApsaraDB for MyBase instance must be connected to the same virtual private cloud (VPC).
    • If the ECS-based user-created instance stores large amounts of data, you must first back up all the data, migrate the backup data to the cloud, and restore the backup data to the ApsaraDB for MyBase instance. Then, you can run the change master to command.