多Namenodes/Namespaces
In order to scale the name service horizontally, federation uses multiple independent Namenodes/namespaces. Namenodes是被联合在一起的,也就是说,Namenodes是独立的而且相互之间是不许配合的。对于所有Namenode,Datanode作为通用存储空间用于存储块。每一个Datanode都向集群中所有Namenode登记。Datanode定期发送心跳和块报告,并处理Namenode发送的命令。
Block Pool
一个Block Pool是一个仅属于一个命名空间的块的集合。集群中Datanode存储所有Block Pool中的块。一个Block Pool是独立于其他块池而管理的。这就允许一个命名空间为新块生成Block ID时不需与其他命名空间协调。一个失效的Namenode不能够阻止服务于集群中其他Namenode的Datanode。
一个Namespace以及其Block Pool一起被称为Namespace Volume。It is a self-contained unit of management. 当一个Namenode/namespace被删除,Datanode上与其相对应的块池也会被删除。Each namespace volume is upgraded as a unit, during cluster upgrade.
命名空间的可扩展性 - HDFS cluster storage scales horizontally but the namespace does not. Large deployments or deployments using lot of small files benefit from scaling the namespace by adding more Namenodes to the cluster
隔离 - 仅有一个Namenode无法提供多用户环境的隔离。An experimental application can overload the Namenode and slow down production critical applications. With multiple Namenodes, different categories of applications and users can be isolated to different namespaces.
Federation的配置
Federation configuration is backward compatible and allows existing single Namenode configuration to work without any change. The new configuration is designed such that all the nodes in the cluster have same configuration without the need for deploying different configuration based on the type of the node in the cluster.
A new abstraction called NameServiceID is added with federation. The Namenode and its corresponding secondary/backup/checkpointer nodes belong to this. To support single configuration file, the Namenode and secondary/backup/checkpointer configuration parameters are suffixed with NameServiceID and are added to the same configuration file.
> $HADOOP_PREFIX_HOME/bin/stop-dfs.sh
These commands can be run from any node where the HDFS configuration is available. The command uses configuration to determine the Namenodes in the cluster and starts the Namenode process on those nodes. The datanodes are started on nodes specified in the slaves file. The script can be used as reference for building your own scripts for starting and stopping the cluster.
Balancer
Balancer has been changed to work with multiple Namenodes in the cluster to balance the cluster. 使用如下命令执行Balancer:
blockpool- 这个是在Block Pool级的均衡存储空间策略。Balancing at block pool level balances storage at the datanode level also. 注意Balancer仅仅是均衡数据而不是均衡命名空间。
Decommissioning
Decommissioning is similar to prior releases. The nodes that need to be decomissioned are added to the exclude file at all the Namenode. Each Namenode decommissions its Block Pool. When all the Namenodes finish decommissioning a datanode, the datanode is considered to be decommissioned. 第一步: To distributed an exclude file to all the Namenodes, use the following command:
"$HADOOP_PREFIX"/bin/distributed-exclude.sh 第二步: Refresh all the Namenodes to pick up the new exclude file.
"$HADOOP_PREFIX"/bin/refresh-namenodes.sh
The above command uses HDFS configuration to determine the Namenodes configured in the cluster and refreshes all the Namenodes to pick up the new exclude file.
Cluster Web Console
与Namenode状态页面类似,federation中添加了一个用于监控联合集群的Web控制台,访问地址为:http:///dfsclusterhealth.jsp。可以用任何一个集群中的Namenode来访问这个页面。
页面提供如下信息:
集群的概要信息,包括文件的数量、块的数量、整个集群中可配置的存储容量、可用的和已用的存储空间信息。
提供Namenode列表,以及每一个Namenode的概况,包括:文件、块、故障块的数量,以及live和dead的Datanode。它还提供一个方便访问Namenode web UI的链接。