Updated on 2022-12-08 GMT+08:00

Backing Up HDFS Service Data

Scenario

To ensure system data security routinely or before and after a critical operation (such as upgrade and migration) on HDFS, HDFS data needs to be backed up. 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 impact on services.

MRS cluster administrators can create a backup task in FusionInsight Manager to back up HDFS data. Both automatic backup tasks and manual backup tasks are supported.

Encrypted directories cannot be backed up or restored.

Prerequisites

  • If you want to back up data to the remote HDFS. A standby cluster for backing up data has been created. The mode of the standby cluster is the same as that of the active cluster. In other backup modes, you do not need to prepare the standby cluster.
  • If the active cluster is deployed in security mode and the active and standby clusters are not managed by the same FusionInsight Manager, configure system mutual trust. For details, see Configuring Cross-Manager Cluster Mutual Trust Relationships. If the active cluster is deployed in normal mode, do not configure mutual trust.
  • Cross-cluster replication has been configured for the active and standby clusters. For details, see Enabling Cross-Cluster Replication.
  • The time of the active cluster and standby cluster must be the same, and the NTP service in the active and standby clusters must use the same time source.
  • Based on the service requirements, plan backup policies, such as the backup task type, period, backup object, and YARN queue that required by the backup task.
  • Check whether HDFS of the standby cluster has sufficient space. It is recommended the directory for storing backup files be a user-defined directory.
  • On the HDFS client, run hdfs lsSnapshottableDir as user hdfs to check the list of directories for which HDFS snapshots have been created in the current cluster. Ensure 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.
  • If you want to back up data to the NAS, you need to deploy the NAS server in advance.

Procedure

  1. On FusionInsight Manager, choose O&M > Backup and Restoration > Backup Management.
  2. Click Create.
  3. Set Name to the name of the backup task.
  4. Select the cluster to be operated from Backup Object.
  5. Set Mode to the type of the backup task.

    Periodic indicates that the backup task is periodically executed and Manual indicates that the backup task is manually executed.

    Table 1 Periodic backup parameters

    Parameter Name

    Description

    Started

    Indicates the time when the task is started for the first time.

    Period

    Indicates task execution interval. The 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 time
    NOTE:
    • Incremental backup is not supported when Manager data and component metadata are backed up. Only Full backup every time is supported.
    • If Mode is set to Periodic and the Path Type is set to NFS or CIFS, the incremental backup function cannot be used. If incremental backup is used in this scenario, data in full backup will be updated in each incremental backup, and no recovery point will be generated.

  6. Set Configuration to HDFS.
  7. Set Path Type of HDFS to a backup directory type.

    The following backup directory types are supported:

    • RemoteHDFS: indicates that the backup files are stored in the HDFS directory of the standby cluster.
      If you select this value, you need to set the following parameters:
      • Destination NameService Name: indicates the NameService name of the standby cluster. You can set it to the NameService name (haclusterX, haclusterX1, haclusterX2, haclusterX3, or haclusterX4) of the built-in remote cluster of the cluster, or the NameService name of a configured remote cluster.
      • IP Mode: mode of the target IP address.The system automatically selects the IP address mode based on the cluster network type, for example, IPv4 or IPv6.
      • Target NameNode IP Address: indicates the NameNode service plane IP address of the standby cluster, supporting the active node or standby node.
      • Target Path: indicates the HDFS directory for storing standby cluster backup data. The save path cannot be an HDFS hidden directory, such as snapshot or recycle bin directory, or a default system directory, such as /hbase or /user/hbase/backup.
      • Maximum Number of Backup Copies: indicates the number of backup files that can be retained in the backup directory.
      • Queue Name: indicates the name of the YARN queue used for backup task execution. The name must be the same as the name of the queue that is running properly in the cluster.
      • Maximum Number of Maps: indicates the maximum number of maps in a MapReduce task. The default value of this parameter is 20.
      • Maximum Bandwidth of a Map (MB/s): indicates the maximum bandwidth of a map. The default value of this parameter is 100.
      • NameService Name: indicates the NameService that corresponds to the selected backup directory. The default value of this parameter is hacluster.
    • NFS: indicates that backup files are stored in the NAS over the NFS protocol.
      If you select NFS, set the following parameters:
      • IP Mode: mode of the target IP address.The system automatically selects the IP address mode based on the cluster network type, for example, IPv4 or IPv6.
      • Server IP Address: indicates the NAS server IP address.
      • Maximum Number of Backup Copies: indicates the number of backup files that can be retained in the backup directory.
      • Server Shared Path: indicates the configured shared directory on the NAS server.
      • Queue Name: indicates the name of the YARN queue used for backup task execution. The name must be the same as the name of the queue that is running properly in the cluster.
      • Maximum Number of Maps: indicates the maximum number of maps in a MapReduce task. The default value of this parameter is 20.
      • Maximum Bandwidth of a Map (MB/s): indicates the maximum bandwidth of a map. The default value of this parameter is 100.
      • NameService Name: indicates the NameService that corresponds to the selected backup directory. The default value of this parameter is hacluster.
    • CIFS: indicates that backup files are stored in the NAS over the CIFS protocol.
      If you select CIFS, set the following parameters:
      • IP Mode: mode of the target IP address.The system automatically selects the IP address mode based on the cluster network type, for example, IPv4 or IPv6.
      • Server IP Address: indicates the NAS server IP address.
      • Port: indicates the port ID used by the CIFS protocol to connect to the NAS server. The default value is 445.
      • Username: indicates the user name that is configured when setting the CIFS protocol.
      • Password: indicates the password that is configured when setting the CIFS protocol.
      • Maximum Number of Backup Copies: indicates the number of backup files that can be retained in the backup directory.
      • Server Shared Path: indicates the configured shared directory on the NAS server.
      • Queue Name: indicates the name of the YARN queue used for backup task execution. The name must be the same as the name of the queue that is running properly in the cluster.
      • Maximum Number of Maps: indicates the maximum number of maps in a MapReduce task. The default value of this parameter is 20.
      • Maximum Bandwidth of a Map (MB/s): indicates the maximum bandwidth of a map. The default value of this parameter is 100.
      • NameService Name: indicates the NameService that corresponds to the selected backup directory. The default value of this parameter is hacluster
    • SFTP: Indicates that backup files are stored in the server using SFTP.
      If you select SFTP, set the following parameters:
      • IP Mode: mode of the target IP address.The system automatically selects the IP address mode based on the cluster network type, for example, IPv4 or IPv6.
      • Server IP Address: Enter the IP address of the server where the backup data is stored.
      • Port: Enter the port number used by the SFTP protocol to connect to the backup server. The default value is 22.
      • Username: Enter the username for connecting to the server using SFTP.
      • Password:Enter the password for connecting to the server using SFTP.
      • Server Shared Path: Enter the backup path on the SFTP server.
      • Maximum Number of Backup Copies: indicates the number of backup files that can be retained in the backup directory.
      • Queue Name: indicates the name of the YARN queue used for backup task execution. The name must be the same as the name of the queue that is running properly in the cluster.
      • Maximum Number of Maps: indicates the maximum number of maps in a MapReduce task. The default value of this parameter is 20.
      • NameService Name: indicates the NameService that corresponds to the selected backup directory. The default value of this parameter is hacluster

  8. Set Maximum Number of Recovery Points to the number of snapshots that can be retained in the cluster.
  9. Set Backup Content to one or multiple HDFS directories to be backed up based on service requirements.

    The following methods are supported to select backup data:

    • Select directly

      Click the name of a directory in the navigation tree to show all the subdirectories in the directory, and select specified directories.

    • Select 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, if all files or subdirectories in the parent directory need to be filtered, enter ([\s\S]*?). If files of which the names consisting of letters and digits, such as file1, need to be filtered, enter file\d*.
      • Click Refresh to view the selected tables in Directory Name.
      • Click Synchronize to save the result.
    • When entering regular expressions, you can 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 cannot contain files that have been written for a long time. Otherwise, the backup task will fail. Therefore, you are advised not to perform operations on the top-level directory, such as /user, /tmp, and /mr-history.

  10. Click Verify to check whether the backup task is configured correctly.

    The possible causes of check failure are as follows:

    • Target NameNode IP address is incorrect.
    • The queue name is incorrect.
    • The HDFS parent directory or subdirectory 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.

  11. Click OK to save the settings.
  12. In the Operation column of the created task in the backup task list, choose More > 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 saved to the related snapshot directories.