---+Hive Disaster Recovery
---++Overview
Falcon provides feature to replicate Hive metadata and data events from source cluster
to destination cluster. This is supported for secure and unsecure cluster through Falcon Recipes.
---++Prerequisites
Following is the prerequisites to use Hive DR
* *Hive 1.2.0+*
* *Oozie 4.2.0+*
*Note:* Set following properties in hive-site.xml for replicating the Hive events on source and destination Hive cluster:
hive.metastore.event.listeners
org.apache.hive.hcatalog.listener.DbNotificationListener
event listeners that are notified of any metastore changes
hive.metastore.dml.events
true
---++ Usage
---+++ Bootstrap
Perform initial bootstrap of Table and Database from source cluster to destination cluster
* *Database Bootstrap*
For bootstrapping DB replication, first destination DB should be created. This step is expected,
since DB replication definitions can be set up by users only on pre-existing DB’s. Second, Export all tables in
the source db and Import it in the destination db, as described in Table bootstrap.
* *Table Bootstrap*
For bootstrapping table replication, essentially after having turned on the !DbNotificationListener
on the source db, perform an Export of the table, distcp the Export over to the destination
warehouse and do an Import over there. Check the following [[https://cwiki.apache.org/confluence/display/Hive/LanguageManual+ImportExport][Hive Export-Import]] for syntax details
and examples.
This will set up the destination table so that the events on the source cluster that modify the table
will then be replicated.
---+++ Setup cluster definition
$FALCON_HOME/bin/falcon entity -submit -type cluster -file /cluster/definition.xml
---+++ Update recipes properties
Update recipe properties file in addons/recipes/hive-disaster-recovery with required attributes for replicating
Hive data and metadata from source cluster to destination cluster.
---+++ Submit Hive DR recipe
$FALCON_HOME/bin/falcon recipe -name hive-disaster-recovery -operation HIVE_DISASTER_RECOVERY
Recipe templates for Hive DR is available in addons/recipes/hive-disaster-recovery and copy it to
recipe path (*falcon.recipe.path=*) by specifying in client.properties.
*Note:* If kerberos security is enabled on cluster, use the secure templates for Hive DR from
addons/recipes/hive-disaster-recovery