Backing Up ClickHouse Service Data
Scenario
To ensure ClickHouse service data security routinely or before a major operation on ClickHouse (such as upgrade or migration), you need to back up ClickHouse service data. 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.
You can create a backup task on FusionInsight Manager to back up ClickHouse service data. Both automatic and manual backup tasks are supported.
Prerequisites
- If data needs to be backed up to the remote HDFS, you have prepared a standby cluster for data backup. The authentication mode of the standby cluster is the same as that of the active cluster. For other backup modes, you do not need to prepare the standby cluster.
- If the active and standby clusters are deployed in security mode and they are not managed by the same FusionInsight Manager, mutual trust must be configured. For details, see Configuring Cross-Manager Mutual Trust Between Clusters. If the active and standby clusters are deployed in normal mode, no mutual trust is required.
- The time on the active and standby clusters must be the same, and the NTP service on the active and standby clusters uses the same time source.
- You have planned the backup type, period, object, and directory based on service requirements.
- The HDFS in the standby cluster has sufficient space. You are advised to save backup files in a custom directory.
- In the active/standby cluster, if data is remotely backed up to HDFS, 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.
Procedure
- On FusionInsight Manager, choose O&M > Backup and Restoration > Backup Management.
- Click Create.
- Set Name to the name of the backup task.
- Select the desired cluster from Backup Object.
- Set Mode to the type of the backup task.
Periodic indicates that the backup task is executed by the system periodically. Manual indicates that the backup task is executed manually.
Table 1 Periodic backup parameters Parameter
Description
Started
The time when the task is started for the first time.
Period
The task execution interval. Value options include Hours and Days.
Backup Policy
- Full backup at the first time and incremental backup subsequently
- Full backup every time
- Full backup once every n times
NOTE:- Incremental backup is not supported when Manager data and component metadata are backed up. Only Full backup every time is supported.
- In Configuration, choose Service Data > ClickHouse > ClickHouse.
- Set Path Type of ClickHouse to a backup directory type.
Table 2 Path of backup data Directory Type
Description
RemoteHDFS
Indicates that the backup files are stored in the HDFS directory of the standby cluster. Only the latest backup file can be retained. Historical backup files are overwritten.
You also need to configure the following parameters:- Destination NameService Name: indicates the NameService name of the standby cluster, for example, hacluster. You can obtain it from the NameService Management page of HDFS of the standby cluster.
- IP Mode: indicates the mode of the target IP address. The system automatically selects an IP address mode based on the cluster network type, for example, IPv4 or IPv6.
- Destination Active NameNode IP Address: indicates the service plane IP address of the active NameNode in the standby cluster.
- Destination Standby NameNode IP Address: indicates the service plane IP address of the standby NameNode in the standby cluster.
- Destination NameNode RPC Port: indicates the value of dfs.namenode.rpc.port in the HDFS basic configuration of the destination cluster.
- Target Path: indicates the HDFS directory for storing standby cluster backup data. The storage path cannot be an HDFS hidden directory, such as a snapshot or recycle bin directory, or a default system directory, such as /hbase or /user/hbase/backup.
OBS
Indicates that backup files are stored in an OBS directory.
- Target Path: indicates the OBS directory for storing backup data.
- Maximum Number of Backup Copies: indicates the number of backup file sets that can be retained in the backup directory.
- Set Maximum Number of Recovery Points to any value from 1 to 1000 because this parameter is not used by ClickHouse.
- Set Backup Content to one or multiple ClickHouse tables to be backed up.
You can select backup data using either of the following methods:
- Adding a backup data file
- Click Add.
- Select the table to be backed up under File Directory, and click Add to add the table to Backup Content.
- Click OK.
- Selecting using regular expressions
- Click Query Regular Expression.
- Enter the logical cluster and database to which the ClickHouse table belongs in the first text box as prompted. The logical cluster and database must match the existing logical cluster and database, for example, /default_cluster/database.
- Enter a regular expression in the second box. Standard regular expressions are supported. For example, to search for all tables that contain the keyword test in the database, enter test.*.
- Click Refresh to view the displayed tables in Directory Name.
- Click Synchronize to save the result.
- When entering regular expressions, click or to add or delete an expression.
- If the selected table or directory is incorrect, click Clear Selected Node to deselect it.
- Adding a backup data file
- Click Verify to check whether the backup task is configured correctly.
The possible causes of the verification failure are as follows:
- The target NameNode IP address is incorrect.
- The directory or table to be backed up does not exist.
- The name of the NameService is incorrect.
- 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 Data source_Task creation time, and the subdirectory is used to save latest data source backup files.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot