Joke Collection Website - Bulletin headlines - Hive data backup and recovery

Hive data backup and recovery

This paper introduces how to back up the data in Hive to disk and restore it from disk to Hive.

1, backup the table data in Hive to disk. ?

Backup example:

The above statement shows that the data in the src_companyinfo table is separated by | and backed up to the directory/root/GRC _ bigdata/backup/src _ companyinfo. ?

The directory structure after backup is as follows:

The directory structure of src_xtbillmx20 13_st browsed in Hue is as follows:?

As can be seen from the above results, the number of output data files is not necessarily the same as the number of files stored in Hive.

2. Restore the files on the disk to Hive. ?

First, execute the table building script in hive:

Then execute the following import command in Hive:

3. It takes 55,386 seconds to back up 46 tables in Hive and one ***552GB data to Linux file system, which takes about 65,438+05.4 hours. ?

It takes 4 12 17 seconds to recover the above data from the Linux file system, and it takes about 1 1.4 hours.

original text