Backing Up ClickHouse Metadata
Scenarios
To ensure ClickHouse metadata security or before a major operation (such as upgrade or migration), you need to back up ClickHouse metadata. The backup data can be used to recover the system if an exception occurs or the operation has not achieved the expected result, minimizing the adverse impacts on services.
ClickHouse metadata backup tasks can be created on FusionInsight Manager. The system supports both automatic and manual backup modes.
MRS clusters support multiple data path types for backing up ClickHouse metadata.
- LocalDir: indicates that backup files are stored on the local disk of the active management node, with the standby management node automatically synchronizing the backup files.
The default storage directory is Data storage path/LocalBackup/, for example, /srv/BigData/LocalBackup.
- RemoteHDFS: indicates that backup files are stored in the HDFS directory of the standby cluster.
- OBS: indicates that backup files are stored in OBS.
Notes and Constraints
- MRS 3.1.0 or later supports this function.
- MRS 3.3.0 and later versions support the backup of ClickHouse metadata to OBS.
Prerequisites
- To back up data to a remote HDFS, the following conditions must be met:
- A standby cluster for backing up data has been created. Its authentication mode must be the same as that of the active cluster.
- If the active cluster is deployed in security mode and the active and standby clusters 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 cluster is deployed in normal mode, mutual trust is not required.
- Time is consistent between the active and standby clusters, with the NTP services on both clusters configured to use the same time source.
- In active/standby mode, ensure that the value of HADOOP_RPC_PROTECTION of ClickHouse is the same as that of hadoop.rpc.protection of HDFS.
- When data is remotely backed up to HDFS, HDFS encrypted directories are not supported.
- If you want to back up data to OBS, you have connected the current cluster to OBS and have the permission to access OBS.
- The backup type, period, policy, and other specifications have been planned based on the service requirements and you have checked whether Data storage path/LocalBackup/ has sufficient space on the active and standby management nodes.
Backing Up ClickHouse Metadata
- Log in to MRS Manager.
For details about how to log in to MRS Manager, see Accessing MRS Manager.
- Choose O&M > Backup and Restoration > Backup Management.
- Click Create.
- Set Name to the name of the backup task.
- Select the cluster to be operated from Backup Object.
- Set Mode to the type of the backup task. Periodic indicates that the backup task is periodically executed. Manual indicates that the backup task is manually executed.
To create a periodic backup task, set the following parameters:
- Started: indicates the time when the task is started for the first time.
- Period: indicates the task execution interval. The options include Hours and Days.
- Backup Policy: Only Full backup every time is supported.
- In Configuration, select ClickHouse under Metadata and other data.
- Select a backup directory type for Path Type of ClickHouse.
If Path Type is RemoteHDFS and the version is MRS 3.1.0 or MRS 3.1.2, configure the environment by referring to Configuring the Environment When the ClickHouse Backup Task's Path is RemoteHDFS.
Table 1 Path of backup data Path Type
Parameter
Description
LocalDir
Maximum Number of Backup Copies
Number of backup files that can be retained in the backup directory.
RemoteHDFS
Destination NameService Name
Name of the NameService in the standby 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.
Destination 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.
Destination 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.
Target 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.
Destination 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.
Target Path
HDFS directory in the standby cluster for storing backup data. The path cannot be configured as an HDFS hidden directory, such as a snapshot or recycle bin directory, nor as a default system directory, such as /hbase or /user/hbase/backup.
Maximum Number of Backup Copies
Number of backup files that can be retained in the backup directory.
This parameter is available only for MRS 3.1.0 and MRS 3.1.2 clusters.
OBS
Target Path
OBS directory for storing backup data.
Maximum Number of Backup Copies
Number of backup files that can be retained in the backup directory.
- Click OK.
- In the Operation column of the created task in the backup task list, click More and select Back Up Now to execute the backup task.
After the backup task is executed, the system automatically creates a subdirectory for each backup task in the backup directory. The format of the subdirectory name is Backup task name_Task creation time, and the subdirectory is used to save data source backup files. The format of the backup file name is Data source_Task execution time.tar.gz.
Configuring the Environment When the ClickHouse Backup Task's Path is RemoteHDFS
This topic is available for MRS 3.1.0 only.
- Log in to MRS Manager of the standby cluster.
For details about how to log in to MRS Manager, see Accessing an MRS Cluster's Manager (Version 2.x or Earlier).
- Choose Cluster > Services > HDFS. Click More and select Download Client. Set Select Client Type to Configuration Files Only, select x86_64 for x86 or aarch64 for Arm based on the type of the node, and click OK.
- After the client file package is generated, download the client to the local PC as prompted and decompress the package.
For example, if the client file package is FusionInsight_Cluster_1_HDFS_Client.tar, decompress it to obtain FusionInsight_Cluster_1_HDFS_ClientConfig_ConfigFiles.tar. Then, decompress this file to the D:\FusionInsight_Cluster_1_HDFS_ClientConfig_ConfigFiles directory on the local PC. The directory name cannot contain spaces.
- Go to the FusionInsight_Cluster_1_HDFS_ClientConfig_ConfigFiles\ client directory and obtain the hosts file.
- Go to FusionInsight_Cluster_1_HDFS_ClientConfig_ConfigFiles\HDFS\config to obtain the core-site.xml and hdfs-site.xml files.
- Log in to MRS Manager of the source cluster.
- Choose Cluster > Services > ClickHouse, click Configurations and then All Configurations, and select Backup under ClickHouse(Service).
For remote_connect_core_config_file, click Upload File and select the core-site.xml file prepared in Step 5.
For remote_connect_hdfs_config_file, click Upload File and select the hdfs-site.xml file prepared in Step 5.
Figure 1 Configuring ClickHouse data backup parameters
- Click Save, confirm the information, and click OK to save the configuration. After saving the configurations, click Finish.
- Choose Cluster > Services > ClickHouse, click Instances, and view the instance IP address of ClickHouseServer.
- Log in to the nodes of the ClickHouseServer instances as user root and check whether the /etc/hosts file contains the host information in Step 4. If not, add the host information in Step 4 to the /etc/hosts file.
Helpful Links
Backup ClickHouse metadata may be restored if data is accidentally modified, deleted, or requires retrieval; if major ClickHouse operations (such as upgrades or migration) cause exceptions in system data or fail to achieve the expected result; if all ClickHouse modules fail and become unavailable; or if data needs to be migrated to a new cluster. For detailed operations, refer to Restoring ClickHouse Metadata.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.