Showing posts with label Hadoop DR. Show all posts
Showing posts with label Hadoop DR. Show all posts

Sunday, September 14, 2014

Hadoop Cluster Disaster Recovery Solution 2/2

Hi Folks, In our last blog we have discussed about the synchronous data replication across the cluster which is pretty much expensive in term of network and performance. Today we will talk about  the asynchronous data replication which less expensive then the previous one.

So lets start, how we can go with asynchronous data replication, what kind or design we required to setup that and how we will make this work.


In above picture we can see the designing of cross data replication, let focus how it works between two clusters.

  1. When a client is writing a HDFS file, after the file is created, it starts to request a new block. And the primary cluster Active NameNode will allocate a new block and select a list of DataNodes for the client to write to. For the file which needs only asynchronous data replication, no remote DataNode from mirror cluster is selected for the pipeline at Active NameNode.
  2. As usual, upon a successful block allocation, the client will write the block data to the first DataNode in the pipeline and also giving the remaining DataNodes.
  3. As usual, the first DataNode will continue to write to the following DataNode in the pipeline until the last. But this time the pipeline doesn’t span to the mirror cluster.
  4. Asynchronously, the mirror cluster Active NameNode will actively schedule to replicate data blocks which are not on any of the local DataNodes. As part of heartbeats it will send MIRROR_REPLICATION_REQUEST which will contain batch of blocks to replicate with target DataNodes selected from mirror cluster. The mirror cluster doesn’t need to aware of real block location in primary cluster.
  5. As a result of handling the MIRROR_REPLICATION_REQUEST, the primary cluster Active NameNode takes care of selecting block location and schedules the replication command to corresponding source DataNode at primary cluster.
  6. A DataNode will be selected to replicate the data block from one of the DataNodes in primary cluster that hold the block.
  7. As a result of the replication pipeline, the local DataNode can replicate the block to other DataNodes of the mirror cluster.

Asynchronous Namespace Journaling 


Synchronous journaling to remote clusters means more latency and performance impact. When the performance is critical, the admin can configure an asynchronous edit log journaling. 





  1. As usual, the primary cluster Active NameNode writes the edit logs to Shared Journal of the primary cluster.
  2. As usual, the primary cluster Standby NameNode tails the edit logs from Shared Journal of the primary cluster.
  1. The mirror cluster Active NameNode tails the edit logs from Shared Journal of the primary cluster. And applies the edit logs to its namespace in memory.
  2. After applying the edit logs to its namespace, the mirror cluster Active NameNode also writes the edit logs to its local Shared Journal.
  3. As usual, the mirror cluster Standby NameNode tails the edit logs from Shared Journal of the mirror cluster. 
Points to remember
  1. Better performance and low letency then the synchronous data replication.
  2. Chance of data loss while asynchronous data replication and primary went down.
  3. Required when performance is critical then the data.

Hadoop Cluster Disaster Recovery Solution 1/2

Hi Folks, whenever we think about the cluster setup and design. We always think about DR how can we save our Data from cluster crash. Today we discuss about the disaster recovery plan for hadoop cluster, what would be steps we can take and how far we can save our data.

Type of Cluster design across data center

1Synchronous Data Replication between cluster
2. ASynchronous Data Replication between cluster

lets talk about the Synchronous Data writing between cluster. Here is the pictorial view of data center design.



  1.  

  1. When a client is writing a HDFS file, after the file is created, it starts to request a new block. And the Active NameNode of primary cluster will allocate a new block and select a list of DataNodes for the client to write to. By using the new mirror block placement policy, the Active NameNode can guarantee one or more remote DataNodes from the mirror cluster are selected at the end of the pipeline.
  2. The primary cluster Active NameNode knows the available DataNodes of the mirror cluster via heartbeats from mirror cluster’s Active NameNode with the MIRROR_DATANODE_AVAILABLE command. So, latest reported DataNodes will be considered for the mirror cluster pipeline which will be appended to primary cluster pipeline.
  3. As usual, upon a successful block allocation, the client will write the block data to the first DataNode in the pipeline and also giving the remaining DataNodes.
  4. As usual, the first DataNode will continue to write to the following DataNode in the pipeline.
  5. The last local DataNode in the pipeline will continue to write the remote DataNode that following.
  6. If there are more than one remote DataNodes are selected, the remote DataNode will continue to write to the following DataNode which is local to the remote DataNode. We provide flexibility to users that they can even configure the mirror cluster replication. Based on the configured replication, mirror nodes will be selected. 


Synchronous Namespace Journaling 



  1. As usual, the primary cluster Active NameNode writes the edit logs to Shared Journal of the primary cluster.
  2. The primary cluster Active NameNode also writes the edit logs to the mirror cluster Active NameNode by using a new JournalManager.
  3. As usual, the primary cluster Standby NameNode tails the edit logs from Shared Journal of the primary cluster.
  4. The mirror cluster Active NameNode writes the edit logs to Shared Journal of the mirror cluster after applying the edit logs received from the primary cluster.
  5. As usual, the mirror cluster Standby NameNode tails the edit logs from Shared Journal of the mirror cluster. 

Points to Remember

  1. Synchronous Data writing is good when the data is very critical and we cant afford to lose consistency at any point of time.
  2. It Actually increase the latency of hadoop data writing, which impact performance of the hadoop cluster.
  3. Required more network bandwidth and  stability to cope with synchronous replication.