Backing Up HDFS Service Data
Scenarios
To ensure HDFS service data security routinely or before a major operation on HDFS (such as upgrade or migration), you need to back up HDFS 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.
HDFS service data 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 HDFS service data.
- RemoteHDFS: indicates that backup files are stored in the HDFS directory of the standby cluster.
- NFS: indicates that backup files are stored in NAS using the NFS protocol.
- CIFS: indicates that backup files are stored in NAS using the CIFS protocol.
- SFTP: indicates that backup files are stored in the server using the SFTP protocol.
- OBS: indicates that backup files are stored in OBS.
Notes and Constraints
- Encrypted directories cannot be backed up or restored.
- MRS 3.5.0 and later versions support the backup of HDFS service data to OBS.
- When data is backed up to storage media (such as OBS, SFTP, and CIFS) other than HDFS, the storage media do not support attributes such as the storage duration, owner group, and quota. Therefore, the preceding attributes cannot be restored after the restoration.
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.
- Cross-cluster replication has been configured for the active and standby clusters. For details, see Enabling MRS Inter-Cluster Replication.
- Time is consistent between the active and standby clusters, with the NTP services on both clusters configured to use the same time source.
- The HDFS in the standby cluster has sufficient space. You are advised to save backup files in a custom directory.
- Backup policies, including the backup task type, period, backup object, backup directory, and Yarn queue required by the backup task are planned based on service requirements.
- On the HDFS client, you have executed the hdfs lsSnapshottableDir command as user hdfs to check the list of directories for which HDFS snapshots have been created in the current cluster and ensured that the HDFS parent directory or subdirectory where data files to be backed up are stored does not have HDFS snapshots. Otherwise, the backup task cannot be created.
- To back up data to NAS, the following conditions must be met. Otherwise, the backup task may fail.
- The NAS server has been deployed. The IP address of the NAS server is accessible to all nodes in the cluster, and NAS disks can be mounted on each NodeManager node.
- The number of concurrent NAS tasks must be greater than or equal to the maximum number of maps configured for the backup task. For details about the parameters, see Step 8.
- The NAS bandwidth must be greater than or equal to the product of the maximum number of maps and the maximum bandwidth of a single map (MB/s). For details about the parameters, see Step 8.
- If you want to back up data to OBS, you have connected the current cluster to OBS and have the permission to access OBS. Only MRS 3.5.0 or later supports data backup to OBS.
Backing Up HDFS Service Data
- Log in to FusionInsight Manager of the MRS cluster.
For details about how to log in to FusionInsight 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 executed by the system periodically. Manual indicates that the backup task is executed manually.
Table 1 Periodic backup parameters Parameter
Example Value
Description
Started
2024/11/22 10:29:11
Time when the task should start for the first time.
Period
1 day
Task execution interval. Supported values are Hours and Days.
Backup Policy
Full backup at the first time and incremental backup subsequently
- Full backup at the first time and incremental backup subsequently
- Full backup every time
- Full backup once every n times
Incremental backup is not supported for Manager data and component metadata. Only Full backup every time is supported.
If Path Type is set to NFS or CIFS, incremental backup cannot be used. When incremental backup is used for NFS or CIFS backup, the latest full backup data is updated each time the incremental backup is performed. Therefore, no new recovery point is generated.
- In Configuration, select HDFS.
- Select a backup directory type for Path Type of HDFS.
Table 2 Path of backup data Path Type
Parameter
Description
RemoteHDFS
Destination NameService Name
Name of the NameService in the standby cluster.
- You can set it to the NameService name (haclusterX, haclusterX1, haclusterX2, haclusterX3, or haclusterX4) of the built-in remote cluster.
- You can also set it to the NameService name of a configured remote cluster.
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.
Target NameNode IP Address
Service plane IP address of the active or standby NameNode in the standby cluster.
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.
- The path cannot be configured 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.
Queue Name
Name of the YARN queue used for backup task execution.
The name must be identical to that of a queue currently running properly in the cluster.
Maximum Number of Maps
Maximum number of maps in a MapReduce task. The default value is 20.
Maximum Map Bandwidth (MB/s)
Maximum bandwidth of a map. The default value is 100.
NameService Name
NameService name of the backup directory. The default value is hacluster.
NFS
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.
Server IP Address
IP address of the NAS server.
Maximum Number of Backup Copies
Number of backup files that can be retained in the backup directory.
Server Shared Path
Shared directory configured on the NAS server by the user.
The shared directory of the server cannot be set to the root directory. The user group and owner group of the shared directory must be configured as nobody:nobody.
Queue Name
Name of the YARN queue used for backup task execution.
The name must be identical to that of a queue currently running properly in the cluster.
Maximum Number of Maps
Maximum number of maps in a MapReduce task. The default value is 20.
Maximum Map Bandwidth (MB/s)
Maximum bandwidth of a map. The default value is 100.
NameService Name
NameService name of the backup directory. The default value is hacluster.
CIFS
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.
Server IP Address
IP address of the NAS server.
Port
Port number used by the CIFS protocol to connect to the NAS server. The default value is 445.
Username
Username configured during CIFS protocol setup.
Password
Password configured during CIFS protocol setup.
Maximum Number of Backup Copies
Number of backup files that can be retained in the backup directory.
Server Shared Path
Shared directory configured on the NAS server by the user.
The shared directory of the server cannot be set to the root directory. The user group and owner group of the shared directory must be configured as nobody:nobody.
Queue Name
Name of the YARN queue used for backup task execution.
The name must be identical to that of a queue currently running properly in the cluster.
Maximum Number of Maps
Maximum number of maps in a MapReduce task. The default value is 20.
Maximum Map Bandwidth (MB/s)
Maximum bandwidth of a map. The default value is 100.
NameService Name
NameService name of the backup directory. The default value is hacluster.
SFTP
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.
Server IP Address
IP address of the server where the backup data is stored.
Port
Port number used by the SFTP protocol to connect to the backup server. The default value is 22.
Username
Username used to connect to the server over SFTP.
Password
Password used to connect to the server over SFTP.
Server Shared Path
Backup path on the SFTP server.
Maximum Number of Backup Copies
Number of backup files that can be retained in the backup directory.
Queue Name
Name of the YARN queue used for backup task execution.
The name must be identical to that of a queue currently running properly in the cluster.
Maximum Number of Maps
Maximum number of maps in a MapReduce task. The default value is 20.
Maximum Map Bandwidth (MB/s)
Maximum bandwidth of a map. The default value is 100.
NameService Name
NameService name of the backup directory. The default value is hacluster.
OBS (available in MRS 3.5.0 and later)
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.
Queue Name
Name of the YARN queue used for backup task execution.
The name must be identical to that of a queue currently running properly in the cluster.
Maximum Number of Maps
Maximum number of maps in a MapReduce task. The default value is 20.
Maximum Map Bandwidth (MB/s)
Maximum bandwidth of a map. The default value is 100.
- Set Maximum Number of Recovery Points to the number of snapshots that can be retained in the cluster.
- Set Backup Content to one or multiple HDFS directories to be backed up based on service requirements.
You can select backup data using either of the following methods:
- Adding a backup data file
Click the name of a database in the navigation pane to show all the tables in the database, and select specified tables.
MRS 3.2.0 or later:
- 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 parent directory full path of the directory in the first text box as prompted. The directory must be the same as the existing directory, for example, /tmp.
- Enter a regular expression in the second text box. Standard regular expressions are supported. For example, to get all files or subdirectories in the parent directory, enter ([\s\S]*?). To get files whose names consist of letters and digits, for example, file1, enter file\d*.
- Click Refresh to view the displayed directories 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.
- The backup directory must not contain files that have been written for a long time. Otherwise, the backup task will fail. Therefore, you are not advised to perform operations on top-level directories such as /user, /tmp, and /mr-history.
- 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 queue name is incorrect.
- The parent directory or subdirectory of the HDFS directory where data files to be backed up are stored has HDFS snapshots.
- 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 Backup task name_Data source_Task creation time, and the subdirectory is used to save latest data source backup files. All the backup file sets are stored in the related snapshot directories.
Helpful Links
Backup HDFS service data may be restored if data is accidentally modified, deleted, or requires retrieval; if major HDFS operations (such as upgrades or significant data adjustments) cause exceptions in system data or fail to achieve the expected result; if all modules fail and become unavailable; or if data needs to be migrated to a new cluster. For detailed operations, refer to Restoring HDFS Service Data.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.