ApsaraDB for ClickHouse allows you to migrate data between ApsaraDB for ClickHouse instances. If you need to migrate data, you can send a request from a source ApsaraDB for ClickHouse instance to a destination ApsaraDB for ClickHouse instance. You can use the data migration feature to migrate data between instances of the same kernel version or from an instance of an earlier kernel version to an instance of a later kernel version. This topic describes how to migrate data between instances in the ApsaraDB for ClickHouse console.

Prerequisites

  • The IP address of your source instance is added to the whitelist of your destination instance.
  • The IP address of your destination instance is added to the whitelist of your source instance.
Note You can execute the select * from system.clusters; statement to query the IP address of an ApsaraDB for ClickHouse instance. For more information about how to configure a whitelist, see Configure a whitelist.

Limits

  • Data can be migrated only to a destination instance whose kernel version is 20.8.7.15. The kernel version of a source instance can be 20.8.7.15 or earlier.
  • ApsaraDB for ClickHouse supports only full data migration.
  • When the system migrates tables that are not in the MergeTree family, such as external tables and log tables, only data is migrated. When the system migrates materialized views, only table schemas are migrated.

Impacts

The following table describes whether read and write operations can be performed on the source and destination instances during and after data migration.

Instance type During migration After migration
Source instance Only read operations are supported. Read and write operations are supported.
Destination instance Read and write operations are not supported. Read and write operations are supported.

Procedure

  1. Log on to the ApsaraDB for ClickHouse console.
  2. On the Clusters page, find the destination instance to which you want to migrate data and click the instance ID.
  3. In the left-side navigation pane of the page that appears, click Migrate Instance.
  4. In the upper-left corner of the data migration page, click Create Migration Task. Migrate data between instances
    Note If no data is migrated to the destination instance, No data available appears on the data migration page.
  5. In the Select the source and destination instances step, specify Instance ID, Database Account, and Database Password in the Source Instance Information section. Then, specify Database Account and Database Password in the Destination Instance Information section. Select the source and destination instances
    Notice You can migrate data only between instances that are deployed in the same region.
  6. Click Test Connectivity and Proceed to check whether the two instances can connect.
    • If a connection is established, proceed to the next step.
    • If a connection fails to establish, you can use one of the following methods to troubleshoot the cause of the connection failure:
      • If the system prompts that authentication failed for the database accounts or database passwords of the source instance and the destination instance, enter Database Account or Database Password again.
      • If the system prompts that the source instance and the destination instance are not connected, check whether the instances are deployed in the same virtual private cloud (VPC) or are attached to the same Cloud Enterprise Network instance.
        Note For more information about how to use a Cloud Enterprise Network instance to connect two instances, see Connect two VPCs under the same Alibaba Cloud account.
  7. After the source and destination instances are connected, proceed to the Migration Content step. Click Next: Pre-detect and Start Synchronization. Migration Content
    Note You can migrate the following objects from the source instance: the cluster, databases, tables, data dictionaries, materialized views, user permissions, and cluster configuration.
  8. After the migration task is configured, the system pre-checks the migration configuration and starts the migration task in the backend.
    • If no issues are detected in the check, click Completed. No issues detected
    • If issues are detected, you must migrate data as instructed. The following table describes the pre-check items.
      Pre-check item Description
      Instance Status Detection Before you migrate data, make sure that no management operations, such as scale-outs, upgrades, or downgrades, are being performed on the source and destination instances. Otherwise, the system cannot start a migration task.
      Replica Consistency Detection The replicas of the source instance and the destination instance must be consistent. Otherwise, the replicas cannot be configured because the required parameters are missing.
      Storage Space Detection Before the migration task is started, check the storage of the source and destination instances. The available storage of the destination instance must be greater than or equal to that of the source instance.
      Local Table and Distributed Table Detection If no distributed table is created based on local tables or the data in distributed tables is not unique, an issue can be detected. Delete redundant distributed tables until only one distributed table exists.
  9. After the migration task is completed, you can view the migration task on the data migration page. Manage migration tasks

References

For information about how to migrate data from a self-managed ClickHouse instance to an ApsaraDB for ClickHouse instance, see Migrate table data from a self-managed ClickHouse cluster to an ApsaraDB for ClickHouse cluster.