SlideShare a Scribd company logo
1 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
DISASTER RECOVERY AND CLOUD
MIGRATION FOR YOUR APACHE
HIVE WAREHOUSE
Sankar Hariappan
Senior Software Engineer, Hortonworks
2 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
 About Apache Hive
 Disaster Recovery
 Replication Modes
 Fail Over
 Fail Back
 Replication at Hive-Scale
 Event Based Replication
 Change Management
 Bootstrapping
 REPL Commands
 Demonstration
 Cloud Migration Challenges
 Future Work
Agenda
3 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
About Apache Hive
 Data warehouse tool built on top of Apache Hadoop.
 Handle data warehousing tasks such as extract/transform/load (ETL), reporting, and
data analysis.
 Manage large datasets residing in distributed storage.
 SQL with Hive specific extensions.
 Query optimization powered by Apache Calcite and execution via Apache Tez, Apache
Spark, or MapReduce.
 Access to files stored either directly in Apache HDFS or in other data storage systems
such as Apache HBase.
 Sub-second query retrieval via Hive LLAP, Apache YARN and Apache Slider.
4 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Apache Hive Architecture
Hive Thrift
Server
JDBC/ODBC
Driver
Compiler Optimizer Executor
HiveServer2
Hive
Metastore
HDFS
YARN
MS
Client RDBMS
5 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Disaster Recovery
 Deployment of clusters in more than one data center for business continuity or geo
localization.
 Hybrid cloud deployment for off-premise processing.
 Robust replication solution to achieve seamless disaster recovery.
– Prevent severe data loss.
– Eliminate single point of failure.
– Fault-tolerant.
6 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Replication Modes
 Master-Slave
Master Slave
Unidirectional
Read ReadWrite
 Master-Master
Master
Bidirectional
Read Write
Master
Read Write
7 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Replication Modes
 Hub and Spoke pattern
Master
Slave
Read
Read
Write
Slave
Read
Slave
Read
Slave
Read
 Relay pattern
Master Slave
Read ReadWrite
Slave
Read
8 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Fail Over
 Slave take over the Master
responsibilities instantaneously.
 Ensure business continuity with minimal
data loss based on Recovery Point
Objective (RPO).
 Almost zero down-time.
Master Slave
Unidirectional
Read Write
Fail over
Read Write
9 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Fail Back
 Slave cluster usually have minimal
processing capabilities which makes Fail
Back an important requirement.
 Original Master comes alive with latest
data.
 Ensure removal of stale data which was
not replicated to the Slave.
 Reverse replicate the delta of data
loaded into the Slave after Fail Over.
Master Slave
Unidirectional
Read ReadWrite
Fail back
10 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Replication at Hive-Scale
 Event based replication.
 First version of Hive Replication (Replv1) uses EXPORT-IMPORT semantics to replicate
data.
– Inefficient mechanism.
– 4X copy problem.
– Rubber-banding issue.
– Depends on external tools such as Falcon/Oozie to manage replication state.
 Second version of Hive Replication (Replv2) uses REPL commands.
– Point-in time replication.
– Reduce number of copies.
– Hive maintains the replicated state.
– Additional support for functions, constraint replication.
11 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Event Logging
HiveServer2
Hive
Metastore
Metastore
RDBMS
Events Table
JDBC/ODBC
Runs Query Manage Metadata
12 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Event Logging
 Capture event: Create/Alter/Drop on DB/Table/Partition/Function/Constraint objects.
 Stored in Metastore RDBMS.
 Event is self-contained to recover the state of the object (metadata + data).
 Events are serialized using sequence number (event id).
13 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Event Based Replication
Metastore
RDBMS
Events Table
HDFS
Serialize new events
batch
Master Cluster
Slave Cluster
HiveServer2
Dump
(metadata + data)
HDFS
Meatastore
RDBMS
HiveServer2
DistcpMetastore API to
write objects
Data files
copy
Read repl
dump dir
REPL DUMP
REPL LOAD
14 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Event Based Replication
 Read batch of events from the Metastore RDBMS in the generated sequence.
 "repl dump <db name> from <event id> "
– get events newer than <event id>.
– includes data files information.
– "<event id>" is last replicated event id for DB from the destination cluster
 "repl load <db name> from <hdfs URI>"
– apply the events on destination
 State replicated in batches currently, can be optimized in future
15 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Change Management
 Replicating the following batch –
– Insert to table
– Drop table
 Need inserted files after drop for replication
 Trash like directory for capturing such files (CM dir)
 Use checksum to verify file, else lookup from CM dir using checksum
 Necessary for ordered replication - State in destination DB would correspond to state in
source X duration back.
16 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Bootstrapping
 What about data generated before event capturing was enabled?
 Bootstrapping - Uses same repl dump/load commands, but is not event based
 Incremental replication catches up with events during bootstrap to make change
consistent with state of source at time X in past.
 Optimized for large database.
 Parallel dump of large number of partitions.
17 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
REPL Commands
 REPL DUMP <db-name> [FROM <start-evid> [TO <end-evid>] [LIMIT <num-evids>] ];
– Execute this command in source cluster.
– REPL DUMP <db-name>; bootstrap the whole database.
– REPL DUMP <db-name> FROM <start-evid>; to replicate all events after start-evid.
– REPL DUMP <db-name> FROM <start-evid> TO <end-evid>; to replicate a range of events.
– REPL DUMP <db-name> FROM <start-evid> LIMIT <num-evids>; to replicate a limited set of events.
 REPL LOAD <db-name> FROM <dump-dir>;
– dump-dir is the HDFS URI returned by REPL DUMP command.
– Execute this command in destination cluster.
 REPL STATUS <db-name>;
– Execute this command in destination cluster.
– Gets the last replicated state of the database in destination which should be the input for REPL
DUMP as start-evid.
18 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Demonstration
19 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Cloud Migration Challenges
 Move is expensive
– Cloud file systems has implemented “move” as “copy”.
– Repl load does atomic move/rename from temp directory to warehouse location.
– ACID and micro-managed tables can potentially help avoiding the move operation.
 On-Prem to Cloud
– Shall run distcp from on-prem cluster to avoid resource overhead on cloud.
– Need to depend on checksum of source files to verify the copied files.
 Cloud to Cloud
– Optimize distcp to use vendor specific tool to copy between cloud file systems.
– Checksum is not consistent/available on all filesystem.
20 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
Future Work
 Replicate ACID/Micro-managed tables.
 Replication to/from cloud storage such as S3 or WASB etc.
 Hot Data Replication.
 Faster Bootstrapping
 Optimize Fail Back.
 Replicate Column Statistics, Index etc
 Table level replication.
21 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
References: REPL Configurations
 hive.metastore.transactional.event.listeners =org.apache.hive.hcatalog.listener.DbNotificationListener
(Capture events)
 hive.repl.rootdir (Root directory used by repl dump)
 hive.metastore.dml.events=true (Enable event generation for DML operations)
 hive.repl.cm.enabled=true (Change Manager to be enabled in source cluster)
 hive.repl.cm.retain=24hr (Expiry time for CM backed-up data files)
 hive.repl.cm.interval=3600s (Time interval to validate expired data files in CM)
 hive.repl.cmrootdir (Root directory for Change Manager)
 hive.repl.replica.functions.root.dir (Root directory to store UDFs/UDAFs jars)
 hive.repl.approx.max.load.tasks=1000 (Limit the DAG size to control the memory consumption)
 hive.repl.partitions.dump.parallelism=5 (Number of threads to concurrently dump partitions)
22 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
References: Hive Doc
https://cwiki.apache.org/confluence/display/Hive/Home
https://cwiki.apache.org/confluence/display/Hive/HiveReplicationv2Development
https://cwiki.apache.org/confluence/display/Hive/HiveReplicationDevelopment
https://cwiki.apache.org/confluence/display/Hive/Replication
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+ImportExport
https://issues.apache.org/jira/browse/HIVE-14841
23 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved
THANK YOU!

More Related Content

PPTX
Dancing elephants - efficiently working with object stores from Apache Spark ...
PPTX
Apache Hadoop 3.0 Community Update
PDF
HPE Hadoop Solutions - From use cases to proposal
PPTX
Managing Hadoop, HBase and Storm Clusters at Yahoo Scale
PDF
Introduction to Apache Amaterasu (Incubating): CD Framework For Your Big Data...
PPTX
Empower Data-Driven Organizations
PPTX
Have your Cake and Eat it Too - Architecture for Batch and Real-time processing
PPTX
A New "Sparkitecture" for modernizing your data warehouse
Dancing elephants - efficiently working with object stores from Apache Spark ...
Apache Hadoop 3.0 Community Update
HPE Hadoop Solutions - From use cases to proposal
Managing Hadoop, HBase and Storm Clusters at Yahoo Scale
Introduction to Apache Amaterasu (Incubating): CD Framework For Your Big Data...
Empower Data-Driven Organizations
Have your Cake and Eat it Too - Architecture for Batch and Real-time processing
A New "Sparkitecture" for modernizing your data warehouse

What's hot (20)

PPTX
Cloudy with a Chance of Hadoop - Real World Considerations
PPTX
IoT:what about data storage?
PPTX
Big Data in the Cloud - The What, Why and How from the Experts
PPTX
DeathStar: Easy, Dynamic, Multi-Tenant HBase via YARN
PDF
Low latency high throughput streaming using Apache Apex and Apache Kudu
PPTX
Operationalizing YARN based Hadoop Clusters in the Cloud
PDF
Spark Uber Development Kit
PPTX
Hadoop in the Cloud - The what, why and how from the experts
PPTX
Apache Hadoop YARN: Present and Future
PPTX
Troubleshooting Kerberos in Hadoop: Taming the Beast
PPTX
HPE Keynote Hadoop Summit San Jose 2016
PPTX
PPTX
Improving Hadoop Resiliency and Operational Efficiency with EMC Isilon
PPTX
To The Cloud and Back: A Look At Hybrid Analytics
PPTX
Build Big Data Enterprise solutions faster on Azure HDInsight
PPTX
Deep Learning using Spark and DL4J for fun and profit
PPTX
Time-oriented event search. A new level of scale
PPTX
Scaling HDFS to Manage Billions of Files with Distributed Storage Schemes
PPTX
A Container-based Sizing Framework for Apache Hadoop/Spark Clusters
PPTX
YARN Ready: Apache Spark
Cloudy with a Chance of Hadoop - Real World Considerations
IoT:what about data storage?
Big Data in the Cloud - The What, Why and How from the Experts
DeathStar: Easy, Dynamic, Multi-Tenant HBase via YARN
Low latency high throughput streaming using Apache Apex and Apache Kudu
Operationalizing YARN based Hadoop Clusters in the Cloud
Spark Uber Development Kit
Hadoop in the Cloud - The what, why and how from the experts
Apache Hadoop YARN: Present and Future
Troubleshooting Kerberos in Hadoop: Taming the Beast
HPE Keynote Hadoop Summit San Jose 2016
Improving Hadoop Resiliency and Operational Efficiency with EMC Isilon
To The Cloud and Back: A Look At Hybrid Analytics
Build Big Data Enterprise solutions faster on Azure HDInsight
Deep Learning using Spark and DL4J for fun and profit
Time-oriented event search. A new level of scale
Scaling HDFS to Manage Billions of Files with Distributed Storage Schemes
A Container-based Sizing Framework for Apache Hadoop/Spark Clusters
YARN Ready: Apache Spark
Ad

Similar to Disaster Recovery and Cloud Migration for your Apache Hive Warehouse (20)

PPTX
Disaster Recovery and Cloud Migration for your Apache Hive Warehouse
PPTX
Seamless Replication and Disaster Recovery for Apache Hive Warehouse
PPTX
Seamless replication and disaster recovery for Apache Hive Warehouse
PPTX
Protecting your Critical Hadoop Clusters Against Disasters
PDF
FOD Paris Meetup - Global Data Management with DataPlane Services (DPS)
PPTX
Manage democratization of the data - Data Replication in Hadoop
PPTX
Optimized Hive replication
PPTX
The Implacable advance of the data
PPTX
Backup and Disaster Recovery in Hadoop
PDF
Disaster Recovery for Big Data by Carlos Izquierdo at Big Data Spain 2017
PDF
Infrastructure Around Hadoop
PPTX
Hive 3 New Horizons DataWorks Summit Melbourne February 2019
PDF
What is New in Apache Hive 3.0?
PDF
Hortonworks Technical Workshop: What's New in HDP 2.3
PPTX
Storage and-compute-hdfs-map reduce
PPTX
Disaster Recovery in the Hadoop Ecosystem: Preparing for the Improbable
PDF
What is new in Apache Hive 3.0?
PDF
Yahoo! Hack Europe Workshop
PPTX
Backup and Disaster Recovery in Hadoop
PPTX
HDFS: Hadoop Distributed Filesystem
Disaster Recovery and Cloud Migration for your Apache Hive Warehouse
Seamless Replication and Disaster Recovery for Apache Hive Warehouse
Seamless replication and disaster recovery for Apache Hive Warehouse
Protecting your Critical Hadoop Clusters Against Disasters
FOD Paris Meetup - Global Data Management with DataPlane Services (DPS)
Manage democratization of the data - Data Replication in Hadoop
Optimized Hive replication
The Implacable advance of the data
Backup and Disaster Recovery in Hadoop
Disaster Recovery for Big Data by Carlos Izquierdo at Big Data Spain 2017
Infrastructure Around Hadoop
Hive 3 New Horizons DataWorks Summit Melbourne February 2019
What is New in Apache Hive 3.0?
Hortonworks Technical Workshop: What's New in HDP 2.3
Storage and-compute-hdfs-map reduce
Disaster Recovery in the Hadoop Ecosystem: Preparing for the Improbable
What is new in Apache Hive 3.0?
Yahoo! Hack Europe Workshop
Backup and Disaster Recovery in Hadoop
HDFS: Hadoop Distributed Filesystem
Ad

More from DataWorks Summit (20)

PPTX
Data Science Crash Course
PPTX
Floating on a RAFT: HBase Durability with Apache Ratis
PPTX
Tracking Crime as It Occurs with Apache Phoenix, Apache HBase and Apache NiFi
PDF
HBase Tales From the Trenches - Short stories about most common HBase operati...
PPTX
Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...
PPTX
Managing the Dewey Decimal System
PPTX
Practical NoSQL: Accumulo's dirlist Example
PPTX
HBase Global Indexing to support large-scale data ingestion at Uber
PPTX
Scaling Cloud-Scale Translytics Workloads with Omid and Phoenix
PPTX
Building the High Speed Cybersecurity Data Pipeline Using Apache NiFi
PPTX
Supporting Apache HBase : Troubleshooting and Supportability Improvements
PPTX
Security Framework for Multitenant Architecture
PDF
Presto: Optimizing Performance of SQL-on-Anything Engine
PPTX
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
PPTX
Extending Twitter's Data Platform to Google Cloud
PPTX
Event-Driven Messaging and Actions using Apache Flink and Apache NiFi
PPTX
Securing Data in Hybrid on-premise and Cloud Environments using Apache Ranger
PPTX
Big Data Meets NVM: Accelerating Big Data Processing with Non-Volatile Memory...
PDF
Computer Vision: Coming to a Store Near You
PPTX
Big Data Genomics: Clustering Billions of DNA Sequences with Apache Spark
Data Science Crash Course
Floating on a RAFT: HBase Durability with Apache Ratis
Tracking Crime as It Occurs with Apache Phoenix, Apache HBase and Apache NiFi
HBase Tales From the Trenches - Short stories about most common HBase operati...
Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...
Managing the Dewey Decimal System
Practical NoSQL: Accumulo's dirlist Example
HBase Global Indexing to support large-scale data ingestion at Uber
Scaling Cloud-Scale Translytics Workloads with Omid and Phoenix
Building the High Speed Cybersecurity Data Pipeline Using Apache NiFi
Supporting Apache HBase : Troubleshooting and Supportability Improvements
Security Framework for Multitenant Architecture
Presto: Optimizing Performance of SQL-on-Anything Engine
Introducing MlFlow: An Open Source Platform for the Machine Learning Lifecycl...
Extending Twitter's Data Platform to Google Cloud
Event-Driven Messaging and Actions using Apache Flink and Apache NiFi
Securing Data in Hybrid on-premise and Cloud Environments using Apache Ranger
Big Data Meets NVM: Accelerating Big Data Processing with Non-Volatile Memory...
Computer Vision: Coming to a Store Near You
Big Data Genomics: Clustering Billions of DNA Sequences with Apache Spark

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
cuic standard and advanced reporting.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Network Security Unit 5.pdf for BCA BBA.
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
A Presentation on Artificial Intelligence
CIFDAQ's Market Insight: SEC Turns Pro Crypto
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Big Data Technologies - Introduction.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
20250228 LYD VKU AI Blended-Learning.pptx
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
NewMind AI Weekly Chronicles - August'25 Week I
NewMind AI Monthly Chronicles - July 2025
cuic standard and advanced reporting.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

Disaster Recovery and Cloud Migration for your Apache Hive Warehouse

  • 1. 1 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved DISASTER RECOVERY AND CLOUD MIGRATION FOR YOUR APACHE HIVE WAREHOUSE Sankar Hariappan Senior Software Engineer, Hortonworks
  • 2. 2 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved  About Apache Hive  Disaster Recovery  Replication Modes  Fail Over  Fail Back  Replication at Hive-Scale  Event Based Replication  Change Management  Bootstrapping  REPL Commands  Demonstration  Cloud Migration Challenges  Future Work Agenda
  • 3. 3 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved About Apache Hive  Data warehouse tool built on top of Apache Hadoop.  Handle data warehousing tasks such as extract/transform/load (ETL), reporting, and data analysis.  Manage large datasets residing in distributed storage.  SQL with Hive specific extensions.  Query optimization powered by Apache Calcite and execution via Apache Tez, Apache Spark, or MapReduce.  Access to files stored either directly in Apache HDFS or in other data storage systems such as Apache HBase.  Sub-second query retrieval via Hive LLAP, Apache YARN and Apache Slider.
  • 4. 4 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Apache Hive Architecture Hive Thrift Server JDBC/ODBC Driver Compiler Optimizer Executor HiveServer2 Hive Metastore HDFS YARN MS Client RDBMS
  • 5. 5 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Disaster Recovery  Deployment of clusters in more than one data center for business continuity or geo localization.  Hybrid cloud deployment for off-premise processing.  Robust replication solution to achieve seamless disaster recovery. – Prevent severe data loss. – Eliminate single point of failure. – Fault-tolerant.
  • 6. 6 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Replication Modes  Master-Slave Master Slave Unidirectional Read ReadWrite  Master-Master Master Bidirectional Read Write Master Read Write
  • 7. 7 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Replication Modes  Hub and Spoke pattern Master Slave Read Read Write Slave Read Slave Read Slave Read  Relay pattern Master Slave Read ReadWrite Slave Read
  • 8. 8 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Fail Over  Slave take over the Master responsibilities instantaneously.  Ensure business continuity with minimal data loss based on Recovery Point Objective (RPO).  Almost zero down-time. Master Slave Unidirectional Read Write Fail over Read Write
  • 9. 9 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Fail Back  Slave cluster usually have minimal processing capabilities which makes Fail Back an important requirement.  Original Master comes alive with latest data.  Ensure removal of stale data which was not replicated to the Slave.  Reverse replicate the delta of data loaded into the Slave after Fail Over. Master Slave Unidirectional Read ReadWrite Fail back
  • 10. 10 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Replication at Hive-Scale  Event based replication.  First version of Hive Replication (Replv1) uses EXPORT-IMPORT semantics to replicate data. – Inefficient mechanism. – 4X copy problem. – Rubber-banding issue. – Depends on external tools such as Falcon/Oozie to manage replication state.  Second version of Hive Replication (Replv2) uses REPL commands. – Point-in time replication. – Reduce number of copies. – Hive maintains the replicated state. – Additional support for functions, constraint replication.
  • 11. 11 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Event Logging HiveServer2 Hive Metastore Metastore RDBMS Events Table JDBC/ODBC Runs Query Manage Metadata
  • 12. 12 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Event Logging  Capture event: Create/Alter/Drop on DB/Table/Partition/Function/Constraint objects.  Stored in Metastore RDBMS.  Event is self-contained to recover the state of the object (metadata + data).  Events are serialized using sequence number (event id).
  • 13. 13 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Event Based Replication Metastore RDBMS Events Table HDFS Serialize new events batch Master Cluster Slave Cluster HiveServer2 Dump (metadata + data) HDFS Meatastore RDBMS HiveServer2 DistcpMetastore API to write objects Data files copy Read repl dump dir REPL DUMP REPL LOAD
  • 14. 14 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Event Based Replication  Read batch of events from the Metastore RDBMS in the generated sequence.  "repl dump <db name> from <event id> " – get events newer than <event id>. – includes data files information. – "<event id>" is last replicated event id for DB from the destination cluster  "repl load <db name> from <hdfs URI>" – apply the events on destination  State replicated in batches currently, can be optimized in future
  • 15. 15 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Change Management  Replicating the following batch – – Insert to table – Drop table  Need inserted files after drop for replication  Trash like directory for capturing such files (CM dir)  Use checksum to verify file, else lookup from CM dir using checksum  Necessary for ordered replication - State in destination DB would correspond to state in source X duration back.
  • 16. 16 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Bootstrapping  What about data generated before event capturing was enabled?  Bootstrapping - Uses same repl dump/load commands, but is not event based  Incremental replication catches up with events during bootstrap to make change consistent with state of source at time X in past.  Optimized for large database.  Parallel dump of large number of partitions.
  • 17. 17 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved REPL Commands  REPL DUMP <db-name> [FROM <start-evid> [TO <end-evid>] [LIMIT <num-evids>] ]; – Execute this command in source cluster. – REPL DUMP <db-name>; bootstrap the whole database. – REPL DUMP <db-name> FROM <start-evid>; to replicate all events after start-evid. – REPL DUMP <db-name> FROM <start-evid> TO <end-evid>; to replicate a range of events. – REPL DUMP <db-name> FROM <start-evid> LIMIT <num-evids>; to replicate a limited set of events.  REPL LOAD <db-name> FROM <dump-dir>; – dump-dir is the HDFS URI returned by REPL DUMP command. – Execute this command in destination cluster.  REPL STATUS <db-name>; – Execute this command in destination cluster. – Gets the last replicated state of the database in destination which should be the input for REPL DUMP as start-evid.
  • 18. 18 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Demonstration
  • 19. 19 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Cloud Migration Challenges  Move is expensive – Cloud file systems has implemented “move” as “copy”. – Repl load does atomic move/rename from temp directory to warehouse location. – ACID and micro-managed tables can potentially help avoiding the move operation.  On-Prem to Cloud – Shall run distcp from on-prem cluster to avoid resource overhead on cloud. – Need to depend on checksum of source files to verify the copied files.  Cloud to Cloud – Optimize distcp to use vendor specific tool to copy between cloud file systems. – Checksum is not consistent/available on all filesystem.
  • 20. 20 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved Future Work  Replicate ACID/Micro-managed tables.  Replication to/from cloud storage such as S3 or WASB etc.  Hot Data Replication.  Faster Bootstrapping  Optimize Fail Back.  Replicate Column Statistics, Index etc  Table level replication.
  • 21. 21 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved References: REPL Configurations  hive.metastore.transactional.event.listeners =org.apache.hive.hcatalog.listener.DbNotificationListener (Capture events)  hive.repl.rootdir (Root directory used by repl dump)  hive.metastore.dml.events=true (Enable event generation for DML operations)  hive.repl.cm.enabled=true (Change Manager to be enabled in source cluster)  hive.repl.cm.retain=24hr (Expiry time for CM backed-up data files)  hive.repl.cm.interval=3600s (Time interval to validate expired data files in CM)  hive.repl.cmrootdir (Root directory for Change Manager)  hive.repl.replica.functions.root.dir (Root directory to store UDFs/UDAFs jars)  hive.repl.approx.max.load.tasks=1000 (Limit the DAG size to control the memory consumption)  hive.repl.partitions.dump.parallelism=5 (Number of threads to concurrently dump partitions)
  • 22. 22 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved References: Hive Doc https://cwiki.apache.org/confluence/display/Hive/Home https://cwiki.apache.org/confluence/display/Hive/HiveReplicationv2Development https://cwiki.apache.org/confluence/display/Hive/HiveReplicationDevelopment https://cwiki.apache.org/confluence/display/Hive/Replication https://cwiki.apache.org/confluence/display/Hive/LanguageManual+ImportExport https://issues.apache.org/jira/browse/HIVE-14841
  • 23. 23 © Hortonworks Inc. Confidential 2011 – 2017. All Rights Reserved THANK YOU!