suneelkumar
suneelkumar

Reputation: 1

How to take database backup in hive? i mean hive database back up

Please any one suggest me how to take hive database backup. we are using mapr.

Regards Sunilkumar

Upvotes: 0

Views: 2122

Answers (1)

Shekhar GS
Shekhar GS

Reputation: 11

Currently I have taken backups of Hive DB by using the Import/ Export hive provided utilities. It will backup both the metadata (hive structure info) and the actual data.

EXPORT TABLE tablename [PARTITION (part_column="value"[, ...])]
  TO 'export_target_path' [ FOR replication('eventid') ]

IMPORT [[EXTERNAL] TABLE new_or_original_tablename 
  [PARTITION (part_column="value"[, ...])]]
  FROM 'source_path'
  [LOCATION 'import_target_path']

But the problem with the above method is for every individual table, you need to provide this statement.

The other method is to get a list of all the available tables in the Hive DB by querying the MySQL Database which will have the metadata of all the Hive Tables. Refer to TBLS table in MySQL for the list of tables.

Upvotes: 1

Related Questions