This document describes how to install, configure, and maintain a major cluster from several nodes to thousands of nodes. For the first time, we recommend that you start from a single-node cluster. A stable version is downloaded from Apache. To install and install a hadoop cluster, you usually need to unzip the software or install the prm on all nodes. Generally, a node in a cluster is treated as N.
This document describes how to install, configure, and maintain a major cluster from several nodes to thousands of nodes. For the first time, we recommend that you start from a single-node cluster. A stable version is downloaded from Apache. To install and install a hadoop cluster, you usually need to unzip the software or install the prm on all nodes. Generally, a node in a cluster is treated as N.
Purpose
This document describes how to install, configure, and maintain a major cluster from several nodes to thousands of nodes.
For the first time, we recommend that you start from a single-node cluster.
Prerequisites
A stable version is downloaded from Apache.
Install
To install a hadoop cluster, you usually need to unzip the software or install the prm on all nodes.
Generally, a node in a cluster is treated as NameNode and other nodes as ResourceManager. These are master nodes. Other nodes are treated as DataNode and NodeManager, which are slave nodes.
Start Hadoop in non-secure mode
The following sections describe how to configure a hadoop cluster.
Configuration File
There are two types of configuration files in hadoop:
Default Configuration of read-only type:Core-default.xml,Hdfs-default.xml,Yarn-default.xmlAndMapred-default.xml
Custom configuration: conf/core-site.xml, conf/hdfs-site.xml, conf/yarn-site.xml and conf/mapred-site.xml.
In addition, you can operate hadoop scripts on your own, which can be found under the bin directory, there are some configuration environment variables in the conf/hadoop-env.sh and yarn-env.sh.
Site Configuration:
To configure a hadoop cluster, you must first configure the environment for executing the hadoop daemon.
The hadoop daemprocess includes NameNode/DataNode and ResourceManager/NodeManager.
Hadoop daemon environment Configuration:
The administrator needs to use the conf/hadoop-env.sh and conf/yarn-env.sh script to configure the environment for the hadoop daemon.
First, verify that JAVA_HOME is correct on all nodes.
Sometimes you needHADOOP_PID_DIRAndThe HADOOP_SECURE_DN_PID_DIR directory can only be written by users who have started the daemon. Otherwise, a soft connection attack will occur.
The administrator can use the configuration items to configure processes separately. The configuration items are as follows:
Daemon Environment Variable
|
| 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
|
To configure Namenode as parallelGC, you can add the following to the hadoop-env.sh:
Python code
- Export HADOOP_NAMENODE_OPTS = "-XX: + UseParallelGC $ {HADOOP_NAMENODE_OPTS }"
Other useful customizable parameters include:
HADOOP_LOG_DIR/YARN_LOG_DIR: Process log directory, which is automatically created if it does not exist.
HADOOP_HEAPSIZE/YARN_HEAPSIZE: the default unit of memory heap size is M. If the variable is set1000 then the heap memory will be set to 1000 MB, the default value is 1000. If you need to configure it, you can configure it separately for each node.
Daemon Environment Variable
|
| ResourceManager |
YARN_RESOURCEMANAGER_HEAPSIZE |
| NodeManager |
YARN_NODEMANAGER_HEAPSIZE |
| WebAppProxy |
YARN_PROXYSERVER_HEAPSIZE |
| Map Reduce Job History Server |
HADOOP_JOB_HISTORYSERVER_HEAPSIZE |
Hadoop daemon non-security mode configuration:
This section describes important parameter configurations, including the following information:
Conf/core-site.xml
Parameter Value Notes
|
| Fs. defaultFS |
NameNode URI |
Hdfs: // host: port/ |
| Io. file. buffer. size |
131072 |
Size of the read/write buffer of SequenceFiles |
Conf/hdfs-site.xml
NameNode Configuration:
Parameter Value Notes
|
| 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 256 MB for large file-systems. |
| Dfs. namenode. handler. count |
100 |
More NameNode server threads to handle RPCs from large number of DataNodes. |
DataNode Configuration:
Parameter Value Notes
|
| Dfs. datanode. data. dir |
Comma separated list of paths on the local filesystem ofDataNodeWhere it shoshould 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 and NodeManager Configuration:
Parameter Value Notes
|
| Yarn. acl. enable |
True/False |
Enable ACLs? DefaultsFalse. |
| Yarn. admin. acl |
Admin ACL |
ACL to set admins on the cluster. ACLs are ofComma-separated-usersspacecomma-separated-groups. Defaults to special value*Which meansAnyone. Special value of justSpaceMeans no one has access. |
| Yarn. log-aggregation-enable |
False |
Configuration to enable or disable log aggregation |
ResourceManager Configuration:
Parameter Value Notes
|
| Yarn. resourcemanager. address |
ResourceManagerHost: port for clients to submit jobs. |
Host: port |
| Yarn. resourcemanager. schedager. address |
ResourceManagerHost: port for ApplicationMasters to talk to Scheduler to obtain resources. |
Host: port |
| Yarn. resourcemanager. resource-tracker.address |
ResourceManagerHost: port for NodeManagers. |
Host: port |
| Yarn. resourcemanager. admin. address |
ResourceManagerHost: port for administrative commands. |
Host: port |
| Yarn. resourcemanager. webapp. address |
ResourceManagerWeb-ui host: port. |
Host: port |
| Yarn. resourcemanager. schedager. class |
ResourceManagerScheduler class. |
CapacityScheduler(Recommended ),FairScheduler(Also recommended), orFifoScheduler |
| Yarn. scheduler. minimum-allocation-mb |
Minimum limit of memory to allocate to each container request atResource Manager. |
In MBs |
| Yarn. scheduler. maximum-allocation-mb |
Maximum limit of memory to allocate to each container request atResource 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 Configuration:
Parameter Value Notes
|
| Yarn. nodemanager. resource. memory-mb |
Resource I. e. available physical memory, in MB, for givenNodeManager |
Defines total available resources onNodeManagerTo 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. |
Running history Configuration:
Parameter Value Notes
|
| 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. |
| 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 application configuration:
Parameter Value Notes
|
| 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 CES. |
| 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 CES to fetch outputs from very large number of maps. |
MapReduce execution history service configuration:
Parameter Value Notes
|
| Mapreduce. jobhistory. address |
MapReduce JobHistory ServerHost: 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 rack awareness
HDFS and YARN services are rack aware.
NameNode and ResourceManager call APIs to obtain the rack information of each slave node in the cluster.
The api uses the dns name (or ip address) as a rack id.
This module is also configurable through topology. node. switch. mapping. you can use the command line parameter topology to configure impl. script. file. name to configure, if topology. script. file. if the name is not configured, its ip address is the rack id by default.