Updated on 2025-12-10 GMT+08:00

Restoring ClickHouse Metadata

Scenarios

ClickHouse metadata restoration is required in the following scenarios: when data is unexpectedly modified or deleted and requires retrieval; when major ClickHouse operations (such as upgrades or migration) cause exceptions in system data or fail to achieve the expected result; when all ClickHouse modules fail and become unavailable; and when data is migrated to a new cluster.

ClickHouse metadata restoration tasks can be created on FusionInsight Manager. The system supports manual data restoration only.

MRS clusters support multiple data path types for restoring ClickHouse metadata.

  • LocalDir: indicates that data is restored from the local disk of the active management node.
  • RemoteHDFS: indicates that data is restored from the HDFS directory of the standby cluster.
  • OBS: indicates that data is restored from OBS.

To restore ClickHouse metadata when the service is running properly, it is recommended that you manually back up the latest ClickHouse metadata prior to restoration. Otherwise, the ClickHouse metadata that is generated after the data backup and before the data restoration will be lost.

Notes and Constraints

  • MRS 3.1.0 or later supports this function.
  • Data restoration can be performed only when the system version is consistent with the version used during data backup.
  • ClickHouse metadata restoration and service data restoration cannot be performed simultaneously. Otherwise, service data restoration fails. You are advised to restore service data only after metadata restoration is complete.
  • MRS 3.3.0 and later support data restoration from OBS.

Impact on the System

  • After the metadata is restored, the data generated after the data backup and before the data restoration is lost.
  • After the metadata is restored, the ClickHouse upper-layer applications need to be started.

Prerequisites

  • You have checked the path for storing ClickHouse metadata backup files.
  • If you need to restore data from a remote HDFS, a standby cluster has been created and the data has been backed up. For details, see Backing Up ClickHouse Metadata. If the active and standby clusters are deployed in security mode and they are not managed by the same FusionInsight Manager, mutual trust has been configured. For details, see Configuring Mutual Trust Between MRS Clusters. If the active and standby clusters are deployed in normal mode, mutual trust is not required.
  • In an active/standby cluster, the value of HADOOP_RPC_PROTECTION of ClickHouse must be the same as that of hadoop.rpc.protection in the HDFS when you restore data from the remote HDFS to the local host.
  • To restore backup data from another MRS ClickHouse cluster to this cluster, the following requirements must be met:
    1. The two clusters are of the same MRS version.
    2. The two clusters are in the same mode.
    3. The two clusters share the same ClickHouse topology, including shards and replicas.

Restoring ClickHouse Metadata

  1. Log in to MRS Manager.

    For details about how to log in to MRS Manager, see Accessing MRS Manager.

  2. Choose O&M > Backup and Restoration > Backup Management.
  3. In the Operation column of the specified task in the task list, choose More > View History.

    In the displayed window, locate the desired success record and click View in the Backup Path column to display the task's backup path information and obtain the following details:

    • Backup Object: indicates the backup data source.
    • Backup Path: indicates the full path where the backup files are stored.

      Locate the correct path, and manually copy the full path of the backup files from the Backup Path column.

  4. On FusionInsight Manager, choose O&M > Backup and Restoration > Restoration Management.
  5. Click Create.
  6. Set Task Name to the name of the restoration task.
  7. Select the cluster to be operated from Recovery Object.
  8. In Restoration Configuration, select ClickHouse under Metadata and other data.
  9. Select a backup directory type for Path Type of ClickHouse.

    Table 1 Path for data restoration

    Path Type

    Parameter

    Description

    LocalDir

    Source Path

    Name of the backup file to be restored. To obtain the file name, log in to the active OMS node, navigate to the backup path copied in Step 3, and record the metadata package name. The file name follows the format: Backup task name_Data source_Task execution time.tar.gz.

    RemoteHDFS

    Source NameService Name

    NameService name of the backup data cluster. You can obtain it from the NameService Management page of HDFS in the standby cluster. For example, the name is hacluster.

    IP Mode

    IP version of the target IP address. The system automatically determines the IP version, such as IPv4 or IPv6, based on the cluster network type.

    Source Active NameNode IP Address

    Service plane IP address of the active NameNode in the standby cluster. Log in to MRS Manager of the standby cluster, choose Cluster > Services > HDFS, click the Instances tab, and check the service plane IP address of the active NameNode.

    This parameter is available only for MRS 3.2.0 and later clusters.

    Source Standby NameNode IP Address

    Service plane IP address of the standby NameNode in the standby cluster. Log in to MRS Manager of the standby cluster, choose Cluster > Services > HDFS, click the Instances tab, and check the service plane IP address of the standby NameNode.

    This parameter is available only for MRS 3.2.0 and later clusters.

    Source NameNode IP Address

    Service plane IP address of the active or standby NameNode in the standby cluster. Log in to MRS Manager of the standby cluster, choose Cluster > Services > HDFS, click the Instances tab, and check the service plane IP address of the NameNode.

    This parameter is available only for MRS 3.1.0 and MRS 3.1.2 clusters.

    Source NameNode RPC Port

    Value of dfs.namenode.rpc.port in the HDFS basic configuration of the destination cluster.

    This parameter is available only for MRS 3.2.0 and later clusters.

    Source Path

    Full path of the HDFS directory storing backup data in the standby cluster. For details, see Backup Path obtained in Step 3. Path format: Backup path/Backup task name_Data source_Task creation time

    OBS

    Source Path

    Full path of the OBS directory storing backup files. Path format: Backup path/Backup task name_Data source_Task creation time/Version_Data source_Task execution time.tar.gz

  10. Click OK.
  11. In the restoration task list, locate the row where the created task is located, and click Start in the Operation column. In the displayed dialog box, click OK to start the restoration task.

    • After the restoration is successful, the progress bar is in green.
    • After the restoration is successful, the restoration task cannot be executed again.
    • If the restoration task fails during the first execution, rectify the fault and click Retry to execute the task again.

  12. Choose Cluster > Services and start the ClickHouse service.