用途
此文档描述了如何安装、配置和维护一个重大集群从几个节点到上千节点。
初次接触hadoop建议先从单节点集群开始。
前提
从Apache 上下载了稳定的版本。
安装
安装hadoop集群通常需要在所有的节点上解压软件或者prm安装。
通常集群中的某一个节点被当做NameNode,其他节点作为ResourceManager,这些是主控节点。其他节点被当做DataNode和NodeManager,这些是从节点。
非安全模式启动Hadoop
接下来的章节将会阐述如何配置hadoop集群。
配置文件
hadoop中的配置文件有两大类型:
只读型默认配置:core-default.xml, hdfs-default.xml, yarn-default.xml and mapred-default.xml
定制化配置:conf/core-site.xml, conf/hdfs-site.xml, conf/yarn-site.xml and conf/mapred-site.xml.
此外:你可以自己操作hadoop的脚本,在bin目录下可以找到,还有一些配置的环境变量在conf/hadoop-env.sh and yarn-env.sh中。
站点配置:
配置hadoop集群你首先要配置hadoop守护进程执行的环境。
hadoop的守护进程包括NameNode/DataNode and ResourceManager/NodeManager.
hadoop守护进程环境配置:
管理员需要使用conf/hadoop-env.sh and conf/yarn-env.sh脚本对hadoop守护进程做环境配置。
首先你要验证JAVA_HOME在所有的节点上是否正确
有时候你需要 HADOOP_PID_DIR and HADOOP_SECURE_DN_PID_DIR目录只能被启动守护进程的用户执行写操作。否则就会出现软连接攻击。
管理员可以利用配置项单独配置进程,配置项如下:
NameNode | HADOOP_NAMENODE_OPTS |
DataNode | HADOOP_DATANODE_OPTS |
Secondary NameNode | HADOOP_SECONDARYNAMENODE_OPTS |
ResourceManager | YARN_RESOURCEMANAGER_OPTS |
NodeManager | YARN_NODEMANAGER_OPTS |
WebAppProxy | YARN_PROXYSERVER_OPTS |
Map Reduce Job History Server | HADOOP_JOB_HISTORYSERVER_OPTS |
如要配置Namenode 为parallelGC,那么可以添加如下到hadoop-env.sh中:
export HADOOP_NAMENODE_OPTS="-XX:+UseParallelGC ${HADOOP_NAMENODE_OPTS}"
其他有用的可定制化参数包括:
HADOOP_LOG_DIR / YARN_LOG_DIR :进程日志目录,如果不存在会自动创建。
HADOOP_HEAPSIZE / YARN_HEAPSIZE:内存堆大小默认单位为M,如果变量设置成1000 那么堆内存会设置成1000M,默认为1000,如果你需要配置他那么你可以为每个节点单独配置。
ResourceManager | YARN_RESOURCEMANAGER_HEAPSIZE |
NodeManager | YARN_NODEMANAGER_HEAPSIZE |
WebAppProxy | YARN_PROXYSERVER_HEAPSIZE |
Map Reduce Job History Server | HADOOP_JOB_HISTORYSERVER_HEAPSIZE |
hadoop守护进程非安全模式配置:
此章节是比较重要的参数配置,涉及信息如下:
conf/core-site.xml
fs.defaultFS | NameNode URI | hdfs://host:port/ |
io.file.buffer.size | 131072 | SequenceFiles的读/写缓冲区大小 |
conf/hdfs-site.xml
NameNode的配置:
dfs.namenode.name.dir | Path on the local filesystem where the NameNode stores the namespace and transactions logs persistently. | If this is a comma-delimited list of directories then the name table is replicated in all of the directories, for redundancy. |
dfs.namenode.hosts /dfs.namenode.hosts.exclude | List of permitted/excluded DataNodes. | If necessary, use these files to control the list of allowable datanodes. |
dfs.blocksize | 268435456 | HDFS blocksize of 256MB for large file-systems. |
dfs.namenode.handler.count | 100 | More NameNode server threads to handle RPCs from large number of DataNodes. |
DataNode配置:
dfs.datanode.data.dir | Comma separated list of paths on the local filesystem of a DataNode where it should store its blocks. | If this is a comma-delimited list of directories, then data will be stored in all named directories, typically on different devices. |
conf/yarn-site.xml
ResourceManager和NodeManager配置:
yarn.acl.enable | true /false | Enable ACLs? Defaults to false. |
yarn.admin.acl | Admin ACL | ACL to set admins on the cluster. ACLs are of for comma-separated-usersspacecomma-separated-groups. Defaults to special value of * which means anyone. Special value of just space means no one has access. |
yarn.log-aggregation-enable | false | Configuration to enable or disable log aggregation |
ResourceManager配置:
yarn.resourcemanager.address | ResourceManager host:port for clients to submit jobs. | host:port |
yarn.resourcemanager.scheduler.address | ResourceManager host:port for ApplicationMasters to talk to Scheduler to obtain resources. | host:port |
yarn.resourcemanager.resource-tracker.address | ResourceManager host:port for NodeManagers. | host:port |
yarn.resourcemanager.admin.address | ResourceManager host:port for administrative commands. | host:port |
yarn.resourcemanager.webapp.address | ResourceManager web-ui host:port. | host:port |
yarn.resourcemanager.scheduler.class | ResourceManager Scheduler class. | CapacityScheduler (recommended), FairScheduler(also recommended), or FifoScheduler |
yarn.scheduler.minimum-allocation-mb | Minimum limit of memory to allocate to each container request at the Resource Manager. | In MBs |
yarn.scheduler.maximum-allocation-mb | Maximum limit of memory to allocate to each container request at the Resource Manager. | In MBs |
yarn.resourcemanager.nodes.include-path /yarn.resourcemanager.nodes.exclude-path | List of permitted/excluded NodeManagers. | If necessary, use these files to control the list of allowable NodeManagers. |
NodeManager配置:
yarn.nodemanager.resource.memory-mb | Resource i.e. available physical memory, in MB, for givenNodeManager | Defines total available resources on the NodeManager to be made available to running containers |
yarn.nodemanager.vmem-pmem-ratio | Maximum ratio by which virtual memory usage of tasks may exceed physical memory | The virtual memory usage of each task may exceed its physical memory limit by this ratio. The total amount of virtual memory used by tasks on the NodeManager may exceed its physical memory usage by this ratio. |
yarn.nodemanager.local-dirs | Comma-separated list of paths on the local filesystem where intermediate data is written. | Multiple paths help spread disk i/o. |
yarn.nodemanager.log-dirs | Comma-separated list of paths on the local filesystem where logs are written. | Multiple paths help spread disk i/o. |
yarn.nodemanager.log.retain-seconds | 10800 | Default time (in seconds) to retain log files on the NodeManager Only applicable if log-aggregation is disabled. |
yarn.nodemanager.remote-app-log-dir | /logs | HDFS directory where the application logs are moved on application completion. Need to set appropriate permissions. Only applicable if log-aggregation is enabled. |
yarn.nodemanager.remote-app-log-dir-suffix | logs | Suffix appended to the remote log dir. Logs will be aggregated to ${yarn.nodemanager.remote-app-log-dir}/${user}/${thisParam} Only applicable if log-aggregation is enabled. |
yarn.nodemanager.aux-services | mapreduce_shuffle | Shuffle service that needs to be set for Map Reduce applications. |
运行历史配置:
yarn.log-aggregation.retain-seconds | -1 | How long to keep aggregation logs before deleting them. -1 disables. Be careful, set this too small and you will spam the name node. |
yarn.log-aggregation.retain-check-interval-seconds | -1 | Time between checks for aggregated log retention. If set to 0 or a negative value then the value is computed as one-tenth of the aggregated log retention time. Be careful, set this too small and you will spam the name node. |
conf/mapred-site.xml
MapReduce应用配置:
mapreduce.framework.name | yarn | Execution framework set to Hadoop YARN. |
mapreduce.map.memory.mb | 1536 | Larger resource limit for maps. |
mapreduce.map.java.opts | -Xmx1024M | Larger heap-size for child jvms of maps. |
mapreduce.reduce.memory.mb | 3072 | Larger resource limit for reduces. |
mapreduce.reduce.java.opts | -Xmx2560M | Larger heap-size for child jvms of reduces. |
mapreduce.task.io.sort.mb | 512 | Higher memory-limit while sorting data for efficiency. |
mapreduce.task.io.sort.factor | 100 | More streams merged at once while sorting files. |
mapreduce.reduce.shuffle.parallelcopies | 50 | Higher number of parallel copies run by reduces to fetch outputs from very large number of maps. |
MapReduce 执行历史服务配置:
mapreduce.jobhistory.address | MapReduce JobHistory Server host:port | Default port is 10020. |
mapreduce.jobhistory.webapp.address | MapReduce JobHistory Server Web UIhost:port | Default port is 19888. |
mapreduce.jobhistory.intermediate-done-dir | /mr-history/tmp | Directory where history files are written by MapReduce jobs. |
mapreduce.jobhistory.done-dir | /mr-history/done | Directory where history files are managed by the MR JobHistory Server. |
Hadoop机架感知
HDFS和YARN服务可机架感知的
NameNode 和ResourceManager通过调用api来获取集群中每个从节点的机架信息。
api以dns名称(或ip)作为一个机架id
这个模块也是可配置的,通过topology.node.switch.mapping.impl来配置,可以通过命令行参数topology.script.file.name来配置,如果topology.script.file.name没有配置那么默认其ip为机架id。
相关推荐
### Hadoop2.2.0集群安装:QJM实现HA及Hdfs-site配置详解 #### 一、Hadoop2.2.0完全分布式集群平台安装设置概述 在深入探讨Hadoop2.2.0的安装过程之前,我们需要了解Hadoop的基本架构以及其核心组件——HDFS...
资源名称:CentOS 6.5 x64下安装19实体节点Hadoop 2.2.0集群配置指南内容简介: CentOS 6.5 x64下安装19实体节点Hadoop 2.2.0集群配置指南主要讲述的是CentOS 6.5 x64下安装19实体节点Hadoop 2.2.0集群配置指南;...
Hadoop 2.2.0 是 Apache Hadoop 的一个关键版本,它包含了众多改进和优化,使得这个分布式计算框架在处理大数据集时更加高效和稳定。在这个配置文件中,我们将会探讨Hadoop 2.2.0 在4台CentOS 6.4系统上运行所需的...
Hadoop 2.2.0是其一个重要版本,它在Hadoop 1.x的基础上进行了大量的优化和改进,增强了系统的稳定性和性能,为大数据处理提供了更强大的支持。 1. 分布式文件系统(HDFS):Hadoop的核心之一是Hadoop Distributed ...
Hadoop 2.2.0 是Apache Hadoop的一个稳定版本,它包含了大量对Hadoop生态系统(包括HDFS、MapReduce、YARN等)的改进和支持。这一版本提供了更好的性能、安全性和可扩展性,适用于处理大规模数据集。 #### 1. HDFS ...
1. 配置环境变量:设置JAVA_HOME指向你的JDK安装路径,确保Hadoop可以找到Java编译器。 2. 预处理:运行`./configure`脚本来配置Hadoop,这个脚本会检查系统环境并生成Makefile。 3. 编译:执行`make`命令,编译源...
在Windows环境下,使用Eclipse进行Hadoop 2.2.0分布式集群的调试是一项重要的技能,这可以帮助开发者更好地理解和优化Hadoop程序。以下是一些关键的知识点,将指导你完成这个过程。 首先,Hadoop是一个开源的分布式...
总结来说,安装Hadoop 2.2.0的关键步骤包括:下载软件包、配置集群环境、设置SSH无密码登录、安装JDK并配置环境变量、调整Hadoop配置文件,以及启动服务。遵循这些步骤,可以顺利地在多台机器上构建一个基本的Hadoop...
《Hadoop2.2.0安装配置及实例教程入门宝典》 在大数据处理领域,Hadoop是一个不可或缺的工具,其分布式存储和计算能力为企业级数据处理提供了强大的支持。本教程将带你逐步走进Hadoop的世界,从零开始,教你如何在...
1. **HDFS相关**:HDFS是Hadoop的核心组件之一,它提供了一个高容错、高吞吐量的数据存储系统。依赖的jar包包括hadoop-hdfs,它包含了HDFS的客户端API和服务器端实现,使得应用程序能够读写HDFS上的数据。 2. **...
在CentSO_64bit集群搭建,hadoop2.2(64位)编译 新版亮点: 基于yarn计算框架和高可用性DFS的第一个稳定版本。 注1:官网只提供32位release版本, 若机器为64位,需要手动编译。 环境配置是个挺烦人的活,麻烦不说还...
本文介绍了一个Hadoop2.2.0集群的搭建过程,在2台4G内存的酷睿双核PC机上,使用VMWare WorkStation虚拟了4个RHEL6.2(1G内存、单核CPU、10G硬盘),总计用10个小时的时间,完成虚拟机制作和Hadoop建立过程,总体比较...
Hadoop是Apache软件基金会开发的一个开源分布式计算框架,它允许在大规模集群中高效处理和存储大量数据。在Hadoop 2.2.0版本中,引入了一套专门为64位操作系统设计的本地库(native libraries),这个zip文件...
Hadoop是Apache软件基金会开发的一个开源分布式计算框架,它允许在大规模集群中高效处理和存储大量数据。在本场景中,我们关注的是Hadoop 2.2.0版本,特别为Windows 10操作系统进行了优化和配置。这个版本在当时是一...
在本文中,我们将深入探讨如何在64位Linux CentOS 6.5系统上编译和安装Hadoop-2.2.0。Hadoop是一个开源的分布式系统基础架构,旨在简化大规模数据处理和存储。它的核心组件包括HDFS(Hadoop Distributed File System...
为了方便开发者在Eclipse中直接操作和管理Hadoop集群,Apache Hadoop社区开发了Hadoop Eclipse Plugin。本文将深入探讨这个名为“hadoop-eclipse-plugin-2.2.0”的插件,以及它如何为Hadoop-2.2.0版本提供支持。 ...
Hadoop是Apache软件基金会开发的一个开源分布式计算框架,主要用于处理和存储大数据。在这个主题中,我们聚焦于Hadoop 2.2.0版本及其在Windows环境下的依赖项,特别是winutils工具。 Hadoop 2.2.0是Hadoop发展历史...
Hadoop是Apache软件基金会的一个项目,它的核心组件包括HDFS(Hadoop Distributed File System)和MapReduce,这两者构成了大数据处理的基础。 **Hadoop Distributed File System (HDFS)** HDFS 是一种分布式文件...