Hadoop常用配置总结

2019-03-28 13:25|来源: 网络

NameNode管理界面:http://namenode:50070

JobTracker管理界面:http://jobtracker:50030

Hadoop守护进程日志存放目录:可以用环境变量${Hadoop_LOG_DIR}进行配置,默认情况下是${HADOOP_HOME}/logs

1.配置类型节点的环境变量

在配置集群的时候可以在conf/hadoop-env.sh配置不同节点的环境变量:

Daemon

Configure Options

NameNode

HADOOP_NAMENODE_OPTS

DataNode

HADOOP_DATANODE_OPTS

SecondaryNamenode

HADOOP_SECONDARYNAMENODE_OPTS

JobTracker

HADOOP_JOBTRACKER_OPTS

TaskTracker

HADOOP_TASKTRACKER_OPTS

例如,可以在hadoop-env.sh中加入下面一行,使NameNode使用ParallelGC

export HADOOP_NAMENODE_OPTS="-XX:+UseParallelGC ${HADOOP_NAMENODE_OPTS}" 

2. 配置Hadoop守护进程
conf/core-site.xml:通过该配置文件配置文件系统根目录,即hdfs://namenode

Parameter

Value

Notes

fs.default.name

URI of NameNode.

hdfs://hostname/

conf/hdfs-site.xml:通过该配置文件,配置NameNodeDataNode数据文件的存放目录

Parameter

Value

Notes

dfs.name.dir

NameNode上存放命名空间和日志的本地目录,即fsimageedits文件的存放目录

如果该配置有由逗号分开的多条目录,那么NameNode会在每条目录中进行冗余存储

dfs.data.dir

DataNode中存放block的目录

如果是由逗号分开的多条目录,则所有的目录都用来存储数据

conf/mapred-site.xml:可以通过这个文件配置MapReduce框架

Parameter

Value

Notes

mapred.job.tracker

JobTrackerIP和端口

host:portpair.

mapred.system.dir

Path on the HDFS where where the MapReduce framework stores system files e.g. /hadoop/mapred/system/.

This is in the default filesystem (HDFS) and must be accessible from both the server and client machines.

mapred.local.dir

Comma-separated list of paths on the local filesystem where temporary MapReduce data is written.

Multiple paths help spread disk i/o.

mapred.tasktracker.{map|reduce}.tasks.maximum

The maximum number of MapReduce tasks, which are run simultaneously on a given TaskTracker, individually.

Defaults to 2 (2 maps and 2 reduces), but vary it depending on your hardware.

dfs.hosts/dfs.hosts.exclude

List of permitted/excluded DataNodes.

If necessary, use these files to control the list of allowable datanodes.

mapred.hosts/mapred.hosts.exclude

List of permitted/excluded TaskTrackers.

If necessary, use these files to control the list of allowable TaskTrackers.

mapred.queue.names

Comma separated list of queues to which jobs can be submitted.

The MapReduce system always supports atleast one queue with the name as default. Hence, this parameter's value should always contain the string default. Some job schedulers supported in Hadoop, like the Capacity Scheduler, support multiple queues. If such a scheduler is being used, the list of configured queue names must be specified here. Once queues are defined, users can submit jobs to a queue using the property name mapred.job.queue.name in the job configuration. There could be a separate configuration file for configuring properties of these queues that is managed by the scheduler. Refer to the documentation of the scheduler for information on the same.

mapred.acls.enabled

Boolean, specifying whether checks for queue ACLs and job ACLs are to be done for authorizing users for doing queue operations and job operations.

If true, queue ACLs are checked while submitting and administering jobs and job ACLs are checked for authorizing view and modification of jobs. Queue ACLs are specified using the configuration parameters of the form mapred.queue.queue-name.acl-name, defined below under mapred-queue-acls.xml. Job ACLs are described at Job Authorization

mapred.task.timeout

Map/reduce task多长时间没有返回就认为他是失败的

一般为10分钟

mapred.map.max.attemptes

如果一个map任务失败,最多可以重新调度的次数

一般为4

mapred.reduce.max.attempts

如果一个reduce任务失败,最多可以重新调度的次数

一般为4

mapred.max.map.failures.percent

一个作业可以允许的map任务失败的比率

有时候我们认为,一个作业即使有一部分任务失败但作业其他任务执行也是有用的,该参数设置一个作业可以允许最多可以承受多少map任务失败

mapred.max.reduce.failures.percent

同上,针对reduce任务

同上,针对reduce任务

mapred.tasktracker.expiry.interval

Tasktracker多长时间没有向JobTracker发送心跳就认为tasktracker失败

默认为10分钟

mapred.user.jobconf.limit

Hadoop能够接受的最多job数量

mapred.tasktracker.map.tasks.maximum

每一个tasktracker能够同时执行的map的个数

默认为2

mapred.tasktracker.reduce.tasks.maximum

每一个tasktracker能够同时执行的reduce的个数

默认为2

下面是Hadoop项目在做一些项目时,对他们的集群所做的配置,在实际工作过程中我们也可以进行参考。

This section lists some non-default configuration parameters which have been used to run the sort benchmark on very large clusters.

Some non-default configuration values used to run sort900, that is 9TB of data sorted on a cluster with 900 nodes:

Configuration File

Parameter

Value

Notes

conf/hdfs-site.xml

dfs.block.size

134217728

HDFS blocksize of 128MB for large file-systems.

conf/hdfs-site.xml

dfs.namenode.handler.count

40

More NameNode server threads to handle RPCs from large number of DataNodes.

conf/mapred-site.xml

mapred.reduce.parallel.copies

20

Higher number of parallel copies run by reduces to fetch outputs from very large number of maps.

conf/mapred-site.xml

mapred.map.child.java.opts

-Xmx512M

Larger heap-size for child jvms of maps.

conf/mapred-site.xml

mapred.reduce.child.java.opts

-Xmx512M

Larger heap-size for child jvms of reduces.

conf/core-site.xml

fs.inmemory.size.mb

200

Larger amount of memory allocated for the in-memory file-system used to merge map-outputs at the reduces.

conf/core-site.xml

io.sort.factor

100

More streams merged at once while sorting files.

conf/core-site.xml

io.sort.mb

200

Higher memory-limit while sorting data.

conf/core-site.xml

io.file.buffer.size

131072

Size of read/write buffer used in SequenceFiles.

Updates to some configuration values to run sort1400 and sort2000, that is 14TB of data sorted on 1400 nodes and 20TB of data sorted on 2000 nodes:

Configuration File

Parameter

Value

Notes

conf/mapred-site.xml

mapred.job.tracker.handler.count

60

More JobTracker server threads to handle RPCs from large number of TaskTrackers.

conf/mapred-site.xml

mapred.reduce.parallel.copies

50

conf/mapred-site.xml

tasktracker.http.threads

50

More worker threads for the TaskTracker's http server. The http server is used by reduces to fetch intermediate map-outputs.

conf/mapred-site.xml

mapred.map.child.java.opts

-Xmx512M

Larger heap-size for child jvms of maps.

conf/mapred-site.xml

mapred.reduce.child.java.opts

-Xmx1024M

Larger heap-size for child jvms of reduces

相关问答

更多
  • Docker最核心的特性之一,就是能够将任何应用包括Hadoop打包到Docker镜像中。这篇教程介绍了利用Docker在单机上快速搭 建多节点 Hadoop集群的详细步骤。作者在发现目前的Hadoop on Docker项目所存在的问题之后,开发了接近最小化的Hadoop镜像,...
  • 同样建议不要用cygwin,总会出现各种意想不到的错误。 非要在windows上做,就在虚拟机上做(vmware workstation),安装教程网上各种。
  • 标题可能描述不清。详细描述一下我的场景。 由于ISP Ban掉了80端口,所以外网做端口映射的时候将81端口映射为内网ip的80端口。 Nginx的部分配置如下: 现在内网访问没问题,外网81端口访问会遇到nginx的301跳转,跳转的时候带过来的Location不是81,而是80
  • hadoop配置[2022-10-16]

    不是你的环境变量的问题。不知道楼主有没有看Hadoop官网上的介绍。Hadoop所使用的jdk需要修改 conf/hadoop-env.sh 文件,在其中设置 JAVA_HOME 环境变量: export JAVA_HOME="C:\Program Files\Java\jdk1.5.0_01” (因为路径中 Program Files 中间有空格,一定要用双引号将路径引起来) 这里必须是修改Hadoop的conf/hadoop-env.sh 文件,和机器的环境变量没有关系。 有中文文档的。在Hadoop目 ...
  • 在过去,大数据处理主要是采用标准化的刀片式服务器和存储区域网络(SAN)来满足网格和处理密集型工作负载。然而随着数据量和用户数的大幅增长,基础设施的需求已经发生变化,硬件厂商必须建立创新体系,来满足大数据对包括存储刀片,SAS(串行连接SCSI)开关,外部SATA阵列和更大容量的机架单元的需求。即寻求一种新的方法来存储和处理复杂的数据,Hadoop正是基于这样的目的应运而生的。Hadoop的数据在集群上均衡分布,并通过复制副本来确保数据的可靠性和容错性。因为数据和对数据处理的操作都是分布在服务器上,处理指令 ...
  • 刚接触的话就换成root用户试试,原因是没有执行权限,或者将hadoop安装目录的所有权限赋予给当前用户
  • 这个问题回答太多了,给你个网址你去找找嘛: http://serverbbs.ccw.com.cn/thread-3915-1-6.html
  • 您正在为要执行的操作设置错误的配置参数。 你想要mapred.tasktracker.map.tasks.maximum 。 您正在设置的是作业的地图任务数量...在大多数情况下,您永远不应该修改。 默认情况下,Hadoop会将mapred.map.tasks设置为块数,所以不要mapred.map.tasks 。 将其添加到mapred-site.xml : mapred.tasktracker.map.tasks.maximum ...
  • 对于hdfs-site.xml http://hadoop.apache.org/docs/r2.4.1/hadoop-project-dist/hadoop-hdfs/hdfs-default.xml 像这样你可以找到其他文件 您可以使用以下格式 dfs.replication 1 For hdfs-site.xml http://hadoop.apach ...
  • 目前尚不清楚您使用的是什么Python库,但假设您使用PySpark,您可以在客户端机器上复制或配置HADOOP_CONF_DIR ,并且可以与任何外部Hadoop系统进行通信。 至少,您需要配置core-site.xml以与HDFS和hive-site.xml进行通信以与Hive进行通信。 如果您使用的是PyHive库 ,则只需连接到user@hiveserver2:1000 It's not clear what Python library you are using, but assuming Py ...