Backup Hive

To backup the Hive service, you must backup the Hive database and create a snapshot of the Hive warehouse.

Backup Hive table data using a snapshot

In Ambari, go to Services > Hive > Configs, and check the value of hive.metastore.warehouse.dir to determine the location of the Hive warehouse, /apps/hive/warehouse by default.
  1. On any node in the cluster, as the HDFS superuser, enable snapshots. For example,
    $ sudo su - hdfs
    $ hdfs dfsadmin -allowSnapshot /apps/hive/warehouse
    Output is:
    Allowing snaphot on /apps/hive/warehouse succeeded
  2. Create a snapshot of the Hive warehouse. For example,
    $ hdfs dfs -createSnapshot /apps/hive/warehouse
    Output includes the name and location of the snapshot:
    Created snapshot /apps/hive/warehouse/.snapshot/s20210308-104702.892

Back up Hive Metastore

On the node where the database you use for Hive Metastore resides, back up Hive Metastore before upgrading to HDP. For example, in MySQL, dump each database as follows:
mysqldump -u <hive_db_user> <hive_db_schema_name> > </path/to/dump_file>

If you use another database for the Hive Metastore, use the equivalent command, such as pg_dump for Postgres to dump the database.