In a typical HA cluster, two separate machines are configured as NameNodes. At any point in time, exactly one of the NameNodes is in an Active state, and the other is in a Standby state. The Active NameNode is responsible for all client operations in the cluster, while the Standby is simply acting as a slave, maintaining enough state to provide a fast failover if necessary.

In order for the Standby node to keep its state synchronized with the Active node, both nodes communicate with a group of separate daemons called "JournalNodes" (JNs). When any namespace modification is performed by the Active node, it durably logs a record of the modification to a majority of these JNs. The Standby node is capable of reading the edits from the JNs, and is constantly watching them for changes to the edit log. As the Standby Node sees the edits, it applies them to its own namespace. In the event of a failover, the Standby will ensure that it has read all of the edits from the JounalNodes before promoting itself to the Active state. This ensures that the namespace state is fully synchronized before a failover occurs.

In order to provide a fast failover, it is also necessary that the Standby node have up-to-date information regarding the location of blocks in the cluster. In order to achieve this, the DataNodes are configured with the location of both NameNodes, and send block location information and heartbeats to both.

It is vital for the correct operation of an HA cluster that only one of the NameNodes be Active at a time. Otherwise, the namespace state would quickly diverge between the two, risking data loss or other incorrect results. In order to ensure this property and prevent the so-called "split-brain scenario," the JournalNodes will only ever allow a single NameNode to be a writer at a time. During a failover, the NameNode which is to become active will simply take over the role of writing to the JournalNodes, which will effectively prevent the other NameNode from continuing in the Active state, allowing the new Active to safely proceed with failover.

 
一个标准的HA集群,要有2个namenode节点,在任何时候,都要保证同一时间只有一个节点是active的,另一个是standby的。active的节点负责
所有客户端的操作。standby仅仅作为一个从节点,时刻准备着进行快速容错。
为了让standby的节点跟active节点的状态保持同步,2个节点通过JN进行通讯。只要在active节点有任何的改变,都要立刻记录到大部分的JN节点中
(注意是大部分而不是全部),standby节点会不停的监听修改日志的的变化,并且有能力读取这些变化。当standby监听到变化的时候,会把这些改变同步到自己的命名空间上(同步源数据)。一旦发生错误,standby节点要确保在变成active之前,要读到JN上所有的变化,这可以保证在容错发生的时候数据是完全同步的。
为了提供一个快速的故障转移,standby必须知道集群中所有块的最新的位置信息,为了能达到这一点,所有的datanode节点必须配置成向2个namenode节点同步块数据,并且也要向2个namenode节点进行心跳检测
 
对一个HA的集群来说,同一时间只有一个namenode节点是active的是至关重要的。否则,这2个namenode的

namespace的状态将会 快速的产生分歧,面临着数据的丢失或者错误的结果。为了确保这个性质(只有一个active的namenode),避免所谓的“精神分裂”,JN在同一时间只允许一个namenode进行写的操作。在故障转移期间,要变成active的那个namenode会接管向JNs写的这个角色,将会强有力的阻止另一个处于active状态的namenode,允许新的active节点安全的进行故障转移。

 
JournalNode 为什么最少是3个
因为在记录修改日志的时候,是往多个JournalNode 节点写的,也就是说只要要有2个节点是正常跑的整个集群才能正常运行,所以如果是3个,
可以容忍1个机器宕机。
Note: There must be at least 3 JournalNode daemons, since edit log modifications must be written to a majority of JNs. This will allow the system to tolerate the failure of a single machine. You may also run more than 3 JournalNodes, but in order to actually increase the number of failures the system can tolerate, you should run an odd number of JNs, (i.e. 3, 5, 7, etc.). Note that when running with N JournalNodes, the system can tolerate at most (N - 1) / 2 failures and continue to function normally.
 
Note that, in an HA cluster, the Standby NameNode also performs checkpoints of the namespace state, and thus it is not necessary to run a Secondary NameNode, CheckpointNode, or BackupNode in an HA cluster. In fact, to do so would be an error. This also allows one who is reconfiguring a non-HA-enabled HDFS cluster to be HA-enabled to reuse the hardware which they had previously dedicated to the Secondary NameNode.
 
Secondary NameNode也没必要有。

DT大数据梦工厂,微信公众号是:DT_Spark,每天都会有大数据实战视频发布,请您持续学习。
相关资料:
scala深入浅出实战经典完整视频、PPT、代码下载:
百度云盘:http://pan.baidu.com/s/1c0noOt6
腾讯微云:http://url.cn/TnGbdC
360云盘:http://yunpan.cn/cQ4c2UALDjSKy  访问密码45e2

 
 
 
 

Dream------Hadoop--Hadoop HA QJM (Quorum Journal Manager)的更多相关文章

  1. hadoop HA+Federation(高可用联邦)搭建配置(二)

    hadoop HA+Federation(高可用联邦)搭建配置(二) 标签(空格分隔): hadoop core-site.xml <?xml version="1.0" e ...

  2. hadoop HA+Federation(高可用联邦)搭建配置(一)

    hadoop HA+Federation(高可用联邦)搭建配置(一) 标签(空格分隔): 未分类 介绍 hadoop 集群一共有4种部署模式,详见<hadoop 生态圈介绍>. HA联邦模 ...

  3. Hadoop集群配置(最全面总结)

    Hadoop集群配置(最全面总结) 通常,集群里的一台机器被指定为 NameNode,另一台不同的机器被指定为JobTracker.这些机器是masters.余下的机器即作为DataNode也作为Ta ...

  4. 【HADOOP】| 环境搭建:从零开始搭建hadoop大数据平台(单机/伪分布式)-下

    因篇幅过长,故分为两节,上节主要说明hadoop运行环境和必须的基础软件,包括VMware虚拟机软件的说明安装.Xmanager5管理软件以及CentOS操作系统的安装和基本网络配置.具体请参看: [ ...

  5. Hadoop集群搭建(完全分布式版本) VMWARE虚拟机

    Hadoop集群搭建(完全分布式版本) VMWARE虚拟机 一.准备工作 三台虚拟机:master.node1.node2 时间同步 ntpdate ntp.aliyun.com 调整时区 cp /u ...

  6. [HDFS Manual] CH4 HDFS High Availability Using the Quorum Journal Manager

    HDFS High Availability Using the Quorum Journal Manager HDFS High Availability Using the Quorum Jour ...

  7. 安装window下的redis,redis可视化管理工具(Redis Desktop Manager)安装,基础使用,实例化项目

    以下包括内容: 一.redis下载安装,启动 二.Redis可视化管理工具(Redis Desktop Manager)安装 三.实例化项目 一.redis下载安装,启动 1,redis官方下载地址: ...

  8. Linux 系统 LVM(Logical Volume Manager)逻辑卷管理

    一.前言 每个Linux使用者在安装Linux时都会遇到这样的困境:在为系统分区时,如何精确评估和分配各个硬盘分区的容量,因为系统管理员不但要考虑到 当前某个分区需要的容量,还要预见该分区以后可能需要 ...

  9. IDM 6.27.5(Internet Download Manager)中文破解版下载神器

    IDM一直是我最喜欢的下载工具,感觉用的比迅雷爽,简单使用,对付网盘有一套.IDM(Internet Download Manager)和迅雷的下载提速方式不同,从原理上来说,IDM速度较稳定,迅雷下 ...

随机推荐

  1. 【spring学习笔记一】Ioc控制反转

    (最近有点捞,在大一的时候还通过写博客的方式督促自己学习唉,先培养起习惯,再找个好点的地方重新开始写博客⑧) Spring是JAVA的一个框架. 有个概念叫依赖注入(或者还有个名字叫控制反转). 概念 ...

  2. 【BootStrap】Table的基本使用

    一.前言        新年新气象,转眼今年就28了,不知道今年能不能把妹成功呢?哈哈哈!上班第一天,部门Web技术主管给每个同事都发了红包鼓励大家今年加油,我作为新转入部门员工不能给团队掉链子,要加 ...

  3. BZOJ 3527 力 | FFT

    BZOJ 3527 力 | 分治 题意 给出数组q,$E_i = \sum_{i < j} \frac{q_i}{(i - j) ^ 2} - \sum_{i > j} \frac{q_i ...

  4. 解题:SHOI 2012 回家的路

    题面 完了,做的时候已经想不起来分层图这个东西了QAQ 对于这种“多种”路径加中转站的题,还有那种有若干次“特殊能力”的题,都可以考虑用分层图来做 显然只需要记录所有的中转站+起点终点,然后拆出横竖两 ...

  5. [SDOI2009] HH去散步 (矩阵乘法)

    link $solution:$ 将边化为点后重新建矩阵,跑$T-1$幂即可(因为跑的是新边). 最后直接找与$x,y$所相连的边即可. #include<iostream> #inclu ...

  6. Apache+tomcat配置动静分离(一个apache一个tomcat,没有做集群)

    1. 下载apache http server,tomcat,mok_jk.so apache下载地址:http://httpd.apache.org/download.cgi tomcat下载地址: ...

  7. Jenkins(一)---我理解的jenkins是这样的

    1.齿轮 如果将 java / maven / ant / git / tomcat / jenkins 等等软件比喻为齿轮:如下图 两个软件在一起可以驱动另外一个软件:如下图 如果把这些软件要集成在 ...

  8. MVC中HTML控件设为只读readonly

    http://www.th7.cn/web/html-css/201501/78934.shtml 1.下拉框设为只读试了试用这个有效: @Html.DropDownListFor(model =&g ...

  9. UESTC--1468

    题目:A Coin Problem 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1468 分析:满足裴波纳契数列,打表找周期. #include<i ...

  10. linux命令总结之lsof命令

    简介 lsof(list open files)是一个列出当前系统打开文件的工具.在linux环境下,任何事物都以文件的形式存在,通过文件不仅仅可以访问常规数据,还可以访问网络连接和硬件.所以如传输控 ...