Scenario
To ensure Hive service data security routinely or before a major operation on Hive (such as upgrade or migration), you need to back up Hive 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 MRS Manager to back up Hive service data. Both automatic and manual backup tasks are supported.
- Hive backup and restoration cannot identify the service and structure relationships of objects such as Hive tables, indexes, and views. When executing backup and restoration tasks, you need to manage unified restoration points based on service scenarios to ensure proper service running.
- Hive backup and restoration do not support Hive on RDB data tables. You need to back up and restore original data tables in external databases independently.
- If the backup data of the standby cluster is lost in an existing Hive backup task that contains Hive on HBase tables, the next incremental backup will fail, and you need to create a Hive backup task again. However, the next full backup task will be normal.
- After the backup function of MRS Manager is used to back up the HDFS directories at the Hive table level, the Hive tables cannot be deleted and recreated.
- If you want to back up data to OBS in MRS 3.5.0 and later, you have connected the current cluster to OBS and have the permission to access OBS.
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 cluster is deployed in security mode and the active and standby clusters are not managed by the same MRS Manager, mutual trust has been configured. For details, see Configuring Cross-Manager Mutual Trust Between Clusters. If the active cluster is deployed in normal mode, no mutual trust is required.
- Cross-cluster replication has been configured for the active and standby clusters. For details, see Enabling Cross-Cluster Replication.
- Time is consistent between the active and standby clusters and the NTP services on the active and standby clusters use the same time source.
- 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.
- The HDFS in the standby cluster has sufficient space. You are advised to save backup files in a custom directory.
- 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.
- If you want to back up data to NAS, you have deployed the NAS server in advance.
Procedure
- On 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 parametersParameter
|
Description
|
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
|
- 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.
- 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, choose Hive > Hive.
- Set Path Type of Hive to a backup directory type.
The following backup directory types are supported:
- 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 Hive tables to be backed up.
You can select backup data using either of the following methods:
- 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.