High availability of HDFs

Source: Internet
Author: User

Backing up Namenode metadata in multiple file systems and creating monitoring points through alternate Namenode can prevent data loss, but still cannot achieve high availability of the file system through federated use. Namenode still has a single point of failure (SPOF) problem. If Namenode fails, all clients-including mapreduce jobs-cannot read, write, or list files because Namenode is the only place where metadata and file-to-block mappings are stored. In this case, the Hadoop system is unable to provide services until a new Namenode is launched.

In such a case, to recover from a failed namenode, the system administrator has to start a new namenode with a copy of the file system metadata and configure the Datanode and the client to use this new namenode. The new namenode will not respond to the service until the following conditions are met: 1) Import the image of the namespace into memory, 2) redo the edit log, 3) receive enough data from the Datanode to report and exit Safe mode. For a large cluster with large numbers of files and chunks, the cold start of Namenode takes 30 minutes or more.

System recovery time is too long and can affect routine maintenance. In fact, the probability of namenode failure is very low, so it is particularly important to plan the system failure time in practical applications.

The 2.x release series for Hadoop adds support for high availability (HA) in HDFs for these issues. In this implementation, a pair of active-standby (Active-standby) Namenode is configured. When the active Namenode fails, the standby Namenode takes over its task and starts to serve requests from the client without any noticeable interruption. Achieving this goal requires the following modifications to the architecture.

Sharing of edit logs is required between namenode through highly available shared storage. (In earlier high-availability implementations, an NFS filter was required to assist the implementation, but in later versions, more choices would be provided, such as systems built on the Zookeeper bookkeeper. When the standby namenode takes over, it will read through the shared edit log until the end to synchronize the state with the active Namenode and continue to read the new entry written by the active Namenode.

Datanode needs to send chunks of data to two namenode at the same time, because the data block's mapping information is stored in Namenode memory, not the disk.

The client needs to use a specific mechanism to handle the failure of the namenode, a mechanism that is transparent to the user.

After the active Namenode fails, the standby namenode is able to implement the task takeover quickly (for a few 10 seconds) because the latest state is stored in memory: includes the latest edit log entries and the latest block mapping information. The actual observed failure time is slightly longer (1 minutes or so) because the system needs to be conservative to determine if the activity namenode is really dead.

In the event that the active Namenode fails and the standby Namenode also fails, of course the probability of such a situation is very low, the administrator can still declare a standby namenode and achieve cold start. Such a situation is not worse than a non-highly available (no-ha) situation, and it is an improvement from an operational standpoint because the above processing is already a standard process and embedded in Hadoop.

Failover and avoidance

A new entity in a system called a Failover controller (Failover_controller) manages the conversion process to transfer the active Namenode to an alternate namenode. The failover controller is pluggable, but its initial implementation is based on zookeeper and thus ensures that there is only one active namenode. Each namenode runs a lightweight failover controller that monitors the host Namenode for failure (implemented through a simple heartbeat mechanism) and fails over when the Namenode fails.

Administrators can also initiate failover manually, such as during routine maintenance. This is called a "smooth failover" because the failover controller can organize two Namenode ordered switching roles.

However, in the case of nonstationary failover, it is not possible to know for sure if the failed Namenode has stopped running. For example, a failover can also be triggered when the network speed is very slow or the networks are partitioned, but the previous activity Namenode is still running and is still active namenode. The highly available implementation is further optimized to ensure that previously active namenode do not perform operations that compromise the system and cause the system to crash-the method is called "circumvention" (fencing). The system introduces a series of circumvention mechanisms, including killing the Namenode process, recovering access to the shared storage directory (typically using the NFS commands specified by the vendor), and blocking the appropriate network port by remote administration commands. The last resort of recourse is that the previous activity Namenode can be circumvented by a fairly image of the technology called Stonith (Shoot the other node in the head), which is primarily powered off by a specific power supply unit for the respective host.

Client-side failover is transparently handled through the client class library. The simplest implementation is the control of failover through the client's configuration file. The HDFS URI uses a logical hostname that maps to a pair of Namenode addresses (set in the configuration file), and the client class library accesses each namenode address until processing is complete.


This article from "Superman College" blog, declined reprint!

High availability of HDFs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.