ClusterSetup.apt.vm 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. ~~ Licensed under the Apache License, Version 2.0 (the "License");
  2. ~~ you may not use this file except in compliance with the License.
  3. ~~ You may obtain a copy of the License at
  4. ~~
  5. ~~ http://www.apache.org/licenses/LICENSE-2.0
  6. ~~
  7. ~~ Unless required by applicable law or agreed to in writing, software
  8. ~~ distributed under the License is distributed on an "AS IS" BASIS,
  9. ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. ~~ See the License for the specific language governing permissions and
  11. ~~ limitations under the License. See accompanying LICENSE file.
  12. ---
  13. Hadoop Map Reduce Next Generation-${project.version} - Cluster Setup
  14. ---
  15. ---
  16. ${maven.build.timestamp}
  17. %{toc|section=1|fromDepth=0}
  18. Hadoop MapReduce Next Generation - Cluster Setup
  19. * {Purpose}
  20. This document describes how to install, configure and manage non-trivial
  21. Hadoop clusters ranging from a few nodes to extremely large clusters
  22. with thousands of nodes.
  23. To play with Hadoop, you may first want to install it on a single
  24. machine (see {{{./SingleCluster.html}Single Node Setup}}).
  25. * {Prerequisites}
  26. Download a stable version of Hadoop from Apache mirrors.
  27. * {Installation}
  28. Installing a Hadoop cluster typically involves unpacking the software on all
  29. the machines in the cluster or installing RPMs.
  30. Typically one machine in the cluster is designated as the NameNode and
  31. another machine the as ResourceManager, exclusively. These are the masters.
  32. The rest of the machines in the cluster act as both DataNode and NodeManager.
  33. These are the slaves.
  34. * {Running Hadoop in Non-Secure Mode}
  35. The following sections describe how to configure a Hadoop cluster.
  36. {Configuration Files}
  37. Hadoop configuration is driven by two types of important configuration files:
  38. * Read-only default configuration - <<<core-default.xml>>>,
  39. <<<hdfs-default.xml>>>, <<<yarn-default.xml>>> and
  40. <<<mapred-default.xml>>>.
  41. * Site-specific configuration - <<conf/core-site.xml>>,
  42. <<conf/hdfs-site.xml>>, <<conf/yarn-site.xml>> and
  43. <<conf/mapred-site.xml>>.
  44. Additionally, you can control the Hadoop scripts found in the bin/
  45. directory of the distribution, by setting site-specific values via the
  46. <<conf/hadoop-env.sh>> and <<yarn-env.sh>>.
  47. {Site Configuration}
  48. To configure the Hadoop cluster you will need to configure the
  49. <<<environment>>> in which the Hadoop daemons execute as well as the
  50. <<<configuration parameters>>> for the Hadoop daemons.
  51. The Hadoop daemons are NameNode/DataNode and ResourceManager/NodeManager.
  52. ** {Configuring Environment of Hadoop Daemons}
  53. Administrators should use the <<conf/hadoop-env.sh>> and
  54. <<conf/yarn-env.sh>> script to do site-specific customization of the
  55. Hadoop daemons' process environment.
  56. At the very least you should specify the <<<JAVA_HOME>>> so that it is
  57. correctly defined on each remote node.
  58. In most cases you should also specify <<<HADOOP_PID_DIR>>> and
  59. <<<HADOOP_SECURE_DN_PID_DIR>>> to point to directories that can only be
  60. written to by the users that are going to run the hadoop daemons.
  61. Otherwise there is the potential for a symlink attack.
  62. Administrators can configure individual daemons using the configuration
  63. options shown below in the table:
  64. *--------------------------------------+--------------------------------------+
  65. || Daemon || Environment Variable |
  66. *--------------------------------------+--------------------------------------+
  67. | NameNode | HADOOP_NAMENODE_OPTS |
  68. *--------------------------------------+--------------------------------------+
  69. | DataNode | HADOOP_DATANODE_OPTS |
  70. *--------------------------------------+--------------------------------------+
  71. | Secondary NameNode | HADOOP_SECONDARYNAMENODE_OPTS |
  72. *--------------------------------------+--------------------------------------+
  73. | ResourceManager | YARN_RESOURCEMANAGER_OPTS |
  74. *--------------------------------------+--------------------------------------+
  75. | NodeManager | YARN_NODEMANAGER_OPTS |
  76. *--------------------------------------+--------------------------------------+
  77. | WebAppProxy | YARN_PROXYSERVER_OPTS |
  78. *--------------------------------------+--------------------------------------+
  79. | Map Reduce Job History Server | HADOOP_JOB_HISTORYSERVER_OPTS |
  80. *--------------------------------------+--------------------------------------+
  81. For example, To configure Namenode to use parallelGC, the following
  82. statement should be added in hadoop-env.sh :
  83. ----
  84. export HADOOP_NAMENODE_OPTS="-XX:+UseParallelGC ${HADOOP_NAMENODE_OPTS}"
  85. ----
  86. Other useful configuration parameters that you can customize include:
  87. * <<<HADOOP_LOG_DIR>>> / <<<YARN_LOG_DIR>>> - The directory where the
  88. daemons' log files are stored. They are automatically created if they
  89. don't exist.
  90. * <<<HADOOP_HEAPSIZE>>> / <<<YARN_HEAPSIZE>>> - The maximum amount of
  91. heapsize to use, in MB e.g. if the varibale is set to 1000 the heap
  92. will be set to 1000MB. This is used to configure the heap
  93. size for the daemon. By default, the value is 1000. If you want to
  94. configure the values separately for each deamon you can use.
  95. *--------------------------------------+--------------------------------------+
  96. || Daemon || Environment Variable |
  97. *--------------------------------------+--------------------------------------+
  98. | ResourceManager | YARN_RESOURCEMANAGER_HEAPSIZE |
  99. *--------------------------------------+--------------------------------------+
  100. | NodeManager | YARN_NODEMANAGER_HEAPSIZE |
  101. *--------------------------------------+--------------------------------------+
  102. | WebAppProxy | YARN_PROXYSERVER_HEAPSIZE |
  103. *--------------------------------------+--------------------------------------+
  104. | Map Reduce Job History Server | HADOOP_JOB_HISTORYSERVER_HEAPSIZE |
  105. *--------------------------------------+--------------------------------------+
  106. ** {Configuring the Hadoop Daemons in Non-Secure Mode}
  107. This section deals with important parameters to be specified in
  108. the given configuration files:
  109. * <<<conf/core-site.xml>>>
  110. *-------------------------+-------------------------+------------------------+
  111. || Parameter || Value || Notes |
  112. *-------------------------+-------------------------+------------------------+
  113. | <<<fs.defaultFS>>> | NameNode URI | <hdfs://host:port/> |
  114. *-------------------------+-------------------------+------------------------+
  115. | <<<io.file.buffer.size>>> | 131072 | |
  116. | | | Size of read/write buffer used in SequenceFiles. |
  117. *-------------------------+-------------------------+------------------------+
  118. * <<<conf/hdfs-site.xml>>>
  119. * Configurations for NameNode:
  120. *-------------------------+-------------------------+------------------------+
  121. || Parameter || Value || Notes |
  122. *-------------------------+-------------------------+------------------------+
  123. | <<<dfs.namenode.name.dir>>> | | |
  124. | | Path on the local filesystem where the NameNode stores the namespace | |
  125. | | and transactions logs persistently. | |
  126. | | | If this is a comma-delimited list of directories then the name table is |
  127. | | | replicated in all of the directories, for redundancy. |
  128. *-------------------------+-------------------------+------------------------+
  129. | <<<dfs.namenode.hosts>>> / <<<dfs.namenode.hosts.exclude>>> | | |
  130. | | List of permitted/excluded DataNodes. | |
  131. | | | If necessary, use these files to control the list of allowable |
  132. | | | datanodes. |
  133. *-------------------------+-------------------------+------------------------+
  134. | <<<dfs.blocksize>>> | 268435456 | |
  135. | | | HDFS blocksize of 256MB for large file-systems. |
  136. *-------------------------+-------------------------+------------------------+
  137. | <<<dfs.namenode.handler.count>>> | 100 | |
  138. | | | More NameNode server threads to handle RPCs from large number of |
  139. | | | DataNodes. |
  140. *-------------------------+-------------------------+------------------------+
  141. * Configurations for DataNode:
  142. *-------------------------+-------------------------+------------------------+
  143. || Parameter || Value || Notes |
  144. *-------------------------+-------------------------+------------------------+
  145. | <<<dfs.datanode.data.dir>>> | | |
  146. | | Comma separated list of paths on the local filesystem of a | |
  147. | | <<<DataNode>>> where it should store its blocks. | |
  148. | | | If this is a comma-delimited list of directories, then data will be |
  149. | | | stored in all named directories, typically on different devices. |
  150. *-------------------------+-------------------------+------------------------+
  151. * <<<conf/yarn-site.xml>>>
  152. * Configurations for ResourceManager and NodeManager:
  153. *-------------------------+-------------------------+------------------------+
  154. || Parameter || Value || Notes |
  155. *-------------------------+-------------------------+------------------------+
  156. | <<<yarn.acl.enable>>> | | |
  157. | | <<<true>>> / <<<false>>> | |
  158. | | | Enable ACLs? Defaults to <false>. |
  159. *-------------------------+-------------------------+------------------------+
  160. | <<<yarn.admin.acl>>> | | |
  161. | | Admin ACL | |
  162. | | | ACL to set admins on the cluster. |
  163. | | | ACLs are of for <comma-separated-users><space><comma-separated-groups>. |
  164. | | | Defaults to special value of <<*>> which means <anyone>. |
  165. | | | Special value of just <space> means no one has access. |
  166. *-------------------------+-------------------------+------------------------+
  167. | <<<yarn.log-aggregation-enable>>> | | |
  168. | | <false> | |
  169. | | | Configuration to enable or disable log aggregation |
  170. *-------------------------+-------------------------+------------------------+
  171. * Configurations for ResourceManager:
  172. *-------------------------+-------------------------+------------------------+
  173. || Parameter || Value || Notes |
  174. *-------------------------+-------------------------+------------------------+
  175. | <<<yarn.resourcemanager.address>>> | | |
  176. | | <<<ResourceManager>>> host:port for clients to submit jobs. | |
  177. | | | <host:port>\ |
  178. | | | If set, overrides the hostname set in <<<yarn.resourcemanager.hostname>>>. |
  179. *-------------------------+-------------------------+------------------------+
  180. | <<<yarn.resourcemanager.scheduler.address>>> | | |
  181. | | <<<ResourceManager>>> host:port for ApplicationMasters to talk to | |
  182. | | Scheduler to obtain resources. | |
  183. | | | <host:port>\ |
  184. | | | If set, overrides the hostname set in <<<yarn.resourcemanager.hostname>>>. |
  185. *-------------------------+-------------------------+------------------------+
  186. | <<<yarn.resourcemanager.resource-tracker.address>>> | | |
  187. | | <<<ResourceManager>>> host:port for NodeManagers. | |
  188. | | | <host:port>\ |
  189. | | | If set, overrides the hostname set in <<<yarn.resourcemanager.hostname>>>. |
  190. *-------------------------+-------------------------+------------------------+
  191. | <<<yarn.resourcemanager.admin.address>>> | | |
  192. | | <<<ResourceManager>>> host:port for administrative commands. | |
  193. | | | <host:port>\ |
  194. | | | If set, overrides the hostname set in <<<yarn.resourcemanager.hostname>>>. |
  195. *-------------------------+-------------------------+------------------------+
  196. | <<<yarn.resourcemanager.webapp.address>>> | | |
  197. | | <<<ResourceManager>>> web-ui host:port. | |
  198. | | | <host:port>\ |
  199. | | | If set, overrides the hostname set in <<<yarn.resourcemanager.hostname>>>. |
  200. *-------------------------+-------------------------+------------------------+
  201. | <<<yarn.resourcemanager.hostname>>> | | |
  202. | | <<<ResourceManager>>> host. | |
  203. | | | <host>\ |
  204. | | | Single hostname that can be set in place of setting all <<<yarn.resourcemanager*address>>> resources. Results in default ports for ResourceManager components. |
  205. *-------------------------+-------------------------+------------------------+
  206. | <<<yarn.resourcemanager.scheduler.class>>> | | |
  207. | | <<<ResourceManager>>> Scheduler class. | |
  208. | | | <<<CapacityScheduler>>> (recommended), <<<FairScheduler>>> (also recommended), or <<<FifoScheduler>>> |
  209. *-------------------------+-------------------------+------------------------+
  210. | <<<yarn.scheduler.minimum-allocation-mb>>> | | |
  211. | | Minimum limit of memory to allocate to each container request at the <<<Resource Manager>>>. | |
  212. | | | In MBs |
  213. *-------------------------+-------------------------+------------------------+
  214. | <<<yarn.scheduler.maximum-allocation-mb>>> | | |
  215. | | Maximum limit of memory to allocate to each container request at the <<<Resource Manager>>>. | |
  216. | | | In MBs |
  217. *-------------------------+-------------------------+------------------------+
  218. | <<<yarn.resourcemanager.nodes.include-path>>> / | | |
  219. | <<<yarn.resourcemanager.nodes.exclude-path>>> | | |
  220. | | List of permitted/excluded NodeManagers. | |
  221. | | | If necessary, use these files to control the list of allowable |
  222. | | | NodeManagers. |
  223. *-------------------------+-------------------------+------------------------+
  224. * Configurations for NodeManager:
  225. *-------------------------+-------------------------+------------------------+
  226. || Parameter || Value || Notes |
  227. *-------------------------+-------------------------+------------------------+
  228. | <<<yarn.nodemanager.resource.memory-mb>>> | | |
  229. | | Resource i.e. available physical memory, in MB, for given <<<NodeManager>>> | |
  230. | | | Defines total available resources on the <<<NodeManager>>> to be made |
  231. | | | available to running containers |
  232. *-------------------------+-------------------------+------------------------+
  233. | <<<yarn.nodemanager.vmem-pmem-ratio>>> | | |
  234. | | Maximum ratio by which virtual memory usage of tasks may exceed |
  235. | | physical memory | |
  236. | | | The virtual memory usage of each task may exceed its physical memory |
  237. | | | limit by this ratio. The total amount of virtual memory used by tasks |
  238. | | | on the NodeManager may exceed its physical memory usage by this ratio. |
  239. *-------------------------+-------------------------+------------------------+
  240. | <<<yarn.nodemanager.local-dirs>>> | | |
  241. | | Comma-separated list of paths on the local filesystem where | |
  242. | | intermediate data is written. ||
  243. | | | Multiple paths help spread disk i/o. |
  244. *-------------------------+-------------------------+------------------------+
  245. | <<<yarn.nodemanager.log-dirs>>> | | |
  246. | | Comma-separated list of paths on the local filesystem where logs | |
  247. | | are written. | |
  248. | | | Multiple paths help spread disk i/o. |
  249. *-------------------------+-------------------------+------------------------+
  250. | <<<yarn.nodemanager.log.retain-seconds>>> | | |
  251. | | <10800> | |
  252. | | | Default time (in seconds) to retain log files on the NodeManager |
  253. | | | Only applicable if log-aggregation is disabled. |
  254. *-------------------------+-------------------------+------------------------+
  255. | <<<yarn.nodemanager.remote-app-log-dir>>> | | |
  256. | | </logs> | |
  257. | | | HDFS directory where the application logs are moved on application |
  258. | | | completion. Need to set appropriate permissions. |
  259. | | | Only applicable if log-aggregation is enabled. |
  260. *-------------------------+-------------------------+------------------------+
  261. | <<<yarn.nodemanager.remote-app-log-dir-suffix>>> | | |
  262. | | <logs> | |
  263. | | | Suffix appended to the remote log dir. Logs will be aggregated to |
  264. | | | $\{yarn.nodemanager.remote-app-log-dir\}/$\{user\}/$\{thisParam\} |
  265. | | | Only applicable if log-aggregation is enabled. |
  266. *-------------------------+-------------------------+------------------------+
  267. | <<<yarn.nodemanager.aux-services>>> | | |
  268. | | mapreduce_shuffle | |
  269. | | | Shuffle service that needs to be set for Map Reduce applications. |
  270. *-------------------------+-------------------------+------------------------+
  271. * Configurations for History Server (Needs to be moved elsewhere):
  272. *-------------------------+-------------------------+------------------------+
  273. || Parameter || Value || Notes |
  274. *-------------------------+-------------------------+------------------------+
  275. | <<<yarn.log-aggregation.retain-seconds>>> | | |
  276. | | <-1> | |
  277. | | | How long to keep aggregation logs before deleting them. -1 disables. |
  278. | | | Be careful, set this too small and you will spam the name node. |
  279. *-------------------------+-------------------------+------------------------+
  280. | <<<yarn.log-aggregation.retain-check-interval-seconds>>> | | |
  281. | | <-1> | |
  282. | | | Time between checks for aggregated log retention. If set to 0 or a |
  283. | | | negative value then the value is computed as one-tenth of the |
  284. | | | aggregated log retention time. |
  285. | | | Be careful, set this too small and you will spam the name node. |
  286. *-------------------------+-------------------------+------------------------+
  287. * <<<conf/mapred-site.xml>>>
  288. * Configurations for MapReduce Applications:
  289. *-------------------------+-------------------------+------------------------+
  290. || Parameter || Value || Notes |
  291. *-------------------------+-------------------------+------------------------+
  292. | <<<mapreduce.framework.name>>> | | |
  293. | | yarn | |
  294. | | | Execution framework set to Hadoop YARN. |
  295. *-------------------------+-------------------------+------------------------+
  296. | <<<mapreduce.map.memory.mb>>> | 1536 | |
  297. | | | Larger resource limit for maps. |
  298. *-------------------------+-------------------------+------------------------+
  299. | <<<mapreduce.map.java.opts>>> | -Xmx1024M | |
  300. | | | Larger heap-size for child jvms of maps. |
  301. *-------------------------+-------------------------+------------------------+
  302. | <<<mapreduce.reduce.memory.mb>>> | 3072 | |
  303. | | | Larger resource limit for reduces. |
  304. *-------------------------+-------------------------+------------------------+
  305. | <<<mapreduce.reduce.java.opts>>> | -Xmx2560M | |
  306. | | | Larger heap-size for child jvms of reduces. |
  307. *-------------------------+-------------------------+------------------------+
  308. | <<<mapreduce.task.io.sort.mb>>> | 512 | |
  309. | | | Higher memory-limit while sorting data for efficiency. |
  310. *-------------------------+-------------------------+------------------------+
  311. | <<<mapreduce.task.io.sort.factor>>> | 100 | |
  312. | | | More streams merged at once while sorting files. |
  313. *-------------------------+-------------------------+------------------------+
  314. | <<<mapreduce.reduce.shuffle.parallelcopies>>> | 50 | |
  315. | | | Higher number of parallel copies run by reduces to fetch outputs |
  316. | | | from very large number of maps. |
  317. *-------------------------+-------------------------+------------------------+
  318. * Configurations for MapReduce JobHistory Server:
  319. *-------------------------+-------------------------+------------------------+
  320. || Parameter || Value || Notes |
  321. *-------------------------+-------------------------+------------------------+
  322. | <<<mapreduce.jobhistory.address>>> | | |
  323. | | MapReduce JobHistory Server <host:port> | Default port is 10020. |
  324. *-------------------------+-------------------------+------------------------+
  325. | <<<mapreduce.jobhistory.webapp.address>>> | | |
  326. | | MapReduce JobHistory Server Web UI <host:port> | Default port is 19888. |
  327. *-------------------------+-------------------------+------------------------+
  328. | <<<mapreduce.jobhistory.intermediate-done-dir>>> | /mr-history/tmp | |
  329. | | | Directory where history files are written by MapReduce jobs. |
  330. *-------------------------+-------------------------+------------------------+
  331. | <<<mapreduce.jobhistory.done-dir>>> | /mr-history/done| |
  332. | | | Directory where history files are managed by the MR JobHistory Server. |
  333. *-------------------------+-------------------------+------------------------+
  334. * {Hadoop Rack Awareness}
  335. The HDFS and the YARN components are rack-aware.
  336. The NameNode and the ResourceManager obtains the rack information of the
  337. slaves in the cluster by invoking an API <resolve> in an administrator
  338. configured module.
  339. The API resolves the DNS name (also IP address) to a rack id.
  340. The site-specific module to use can be configured using the configuration
  341. item <<<topology.node.switch.mapping.impl>>>. The default implementation
  342. of the same runs a script/command configured using
  343. <<<topology.script.file.name>>>. If <<<topology.script.file.name>>> is
  344. not set, the rack id </default-rack> is returned for any passed IP address.
  345. * {Monitoring Health of NodeManagers}
  346. Hadoop provides a mechanism by which administrators can configure the
  347. NodeManager to run an administrator supplied script periodically to
  348. determine if a node is healthy or not.
  349. Administrators can determine if the node is in a healthy state by
  350. performing any checks of their choice in the script. If the script
  351. detects the node to be in an unhealthy state, it must print a line to
  352. standard output beginning with the string ERROR. The NodeManager spawns
  353. the script periodically and checks its output. If the script's output
  354. contains the string ERROR, as described above, the node's status is
  355. reported as <<<unhealthy>>> and the node is black-listed by the
  356. ResourceManager. No further tasks will be assigned to this node.
  357. However, the NodeManager continues to run the script, so that if the
  358. node becomes healthy again, it will be removed from the blacklisted nodes
  359. on the ResourceManager automatically. The node's health along with the
  360. output of the script, if it is unhealthy, is available to the
  361. administrator in the ResourceManager web interface. The time since the
  362. node was healthy is also displayed on the web interface.
  363. The following parameters can be used to control the node health
  364. monitoring script in <<<conf/yarn-site.xml>>>.
  365. *-------------------------+-------------------------+------------------------+
  366. || Parameter || Value || Notes |
  367. *-------------------------+-------------------------+------------------------+
  368. | <<<yarn.nodemanager.health-checker.script.path>>> | | |
  369. | | Node health script | |
  370. | | | Script to check for node's health status. |
  371. *-------------------------+-------------------------+------------------------+
  372. | <<<yarn.nodemanager.health-checker.script.opts>>> | | |
  373. | | Node health script options | |
  374. | | | Options for script to check for node's health status. |
  375. *-------------------------+-------------------------+------------------------+
  376. | <<<yarn.nodemanager.health-checker.script.interval-ms>>> | | |
  377. | | Node health script interval | |
  378. | | | Time interval for running health script. |
  379. *-------------------------+-------------------------+------------------------+
  380. | <<<yarn.nodemanager.health-checker.script.timeout-ms>>> | | |
  381. | | Node health script timeout interval | |
  382. | | | Timeout for health script execution. |
  383. *-------------------------+-------------------------+------------------------+
  384. The health checker script is not supposed to give ERROR if only some of the
  385. local disks become bad. NodeManager has the ability to periodically check
  386. the health of the local disks (specifically checks nodemanager-local-dirs
  387. and nodemanager-log-dirs) and after reaching the threshold of number of
  388. bad directories based on the value set for the config property
  389. yarn.nodemanager.disk-health-checker.min-healthy-disks, the whole node is
  390. marked unhealthy and this info is sent to resource manager also. The boot
  391. disk is either raided or a failure in the boot disk is identified by the
  392. health checker script.
  393. * {Slaves file}
  394. Typically you choose one machine in the cluster to act as the NameNode and
  395. one machine as to act as the ResourceManager, exclusively. The rest of the
  396. machines act as both a DataNode and NodeManager and are referred to as
  397. <slaves>.
  398. List all slave hostnames or IP addresses in your <<<conf/slaves>>> file,
  399. one per line.
  400. * {Logging}
  401. Hadoop uses the Apache log4j via the Apache Commons Logging framework for
  402. logging. Edit the <<<conf/log4j.properties>>> file to customize the
  403. Hadoop daemons' logging configuration (log-formats and so on).
  404. * {Operating the Hadoop Cluster}
  405. Once all the necessary configuration is complete, distribute the files to the
  406. <<<HADOOP_CONF_DIR>>> directory on all the machines.
  407. ** Hadoop Startup
  408. To start a Hadoop cluster you will need to start both the HDFS and YARN
  409. cluster.
  410. Format a new distributed filesystem:
  411. ----
  412. $ $HADOOP_PREFIX/bin/hdfs namenode -format <cluster_name>
  413. ----
  414. Start the HDFS with the following command, run on the designated NameNode:
  415. ----
  416. $ $HADOOP_PREFIX/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script hdfs start namenode
  417. ----
  418. Run a script to start DataNodes on all slaves:
  419. ----
  420. $ $HADOOP_PREFIX/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script hdfs start datanode
  421. ----
  422. Start the YARN with the following command, run on the designated
  423. ResourceManager:
  424. ----
  425. $ $HADOOP_YARN_HOME/sbin/yarn-daemon.sh --config $HADOOP_CONF_DIR start resourcemanager
  426. ----
  427. Run a script to start NodeManagers on all slaves:
  428. ----
  429. $ $HADOOP_YARN_HOME/sbin/yarn-daemon.sh --config $HADOOP_CONF_DIR start nodemanager
  430. ----
  431. Start a standalone WebAppProxy server. If multiple servers
  432. are used with load balancing it should be run on each of them:
  433. ----
  434. $ $HADOOP_YARN_HOME/sbin/yarn-daemon.sh start proxyserver --config $HADOOP_CONF_DIR
  435. ----
  436. Start the MapReduce JobHistory Server with the following command, run on the
  437. designated server:
  438. ----
  439. $ $HADOOP_PREFIX/sbin/mr-jobhistory-daemon.sh start historyserver --config $HADOOP_CONF_DIR
  440. ----
  441. ** Hadoop Shutdown
  442. Stop the NameNode with the following command, run on the designated
  443. NameNode:
  444. ----
  445. $ $HADOOP_PREFIX/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script hdfs stop namenode
  446. ----
  447. Run a script to stop DataNodes on all slaves:
  448. ----
  449. $ $HADOOP_PREFIX/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script hdfs stop datanode
  450. ----
  451. Stop the ResourceManager with the following command, run on the designated
  452. ResourceManager:
  453. ----
  454. $ $HADOOP_YARN_HOME/sbin/yarn-daemon.sh --config $HADOOP_CONF_DIR stop resourcemanager
  455. ----
  456. Run a script to stop NodeManagers on all slaves:
  457. ----
  458. $ $HADOOP_YARN_HOME/sbin/yarn-daemon.sh --config $HADOOP_CONF_DIR stop nodemanager
  459. ----
  460. Stop the WebAppProxy server. If multiple servers are used with load
  461. balancing it should be run on each of them:
  462. ----
  463. $ $HADOOP_YARN_HOME/sbin/yarn-daemon.sh stop proxyserver --config $HADOOP_CONF_DIR
  464. ----
  465. Stop the MapReduce JobHistory Server with the following command, run on the
  466. designated server:
  467. ----
  468. $ $HADOOP_PREFIX/sbin/mr-jobhistory-daemon.sh stop historyserver --config $HADOOP_CONF_DIR
  469. ----
  470. * {Operating the Hadoop Cluster}
  471. Once all the necessary configuration is complete, distribute the files to the
  472. <<<HADOOP_CONF_DIR>>> directory on all the machines.
  473. This section also describes the various Unix users who should be starting the
  474. various components and uses the same Unix accounts and groups used previously:
  475. ** Hadoop Startup
  476. To start a Hadoop cluster you will need to start both the HDFS and YARN
  477. cluster.
  478. Format a new distributed filesystem as <hdfs>:
  479. ----
  480. [hdfs]$ $HADOOP_PREFIX/bin/hdfs namenode -format <cluster_name>
  481. ----
  482. Start the HDFS with the following command, run on the designated NameNode
  483. as <hdfs>:
  484. ----
  485. [hdfs]$ $HADOOP_PREFIX/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script hdfs start namenode
  486. ----
  487. Run a script to start DataNodes on all slaves as <root> with a special
  488. environment variable <<<HADOOP_SECURE_DN_USER>>> set to <hdfs>:
  489. ----
  490. [root]$ HADOOP_SECURE_DN_USER=hdfs $HADOOP_PREFIX/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script hdfs start datanode
  491. ----
  492. Start the YARN with the following command, run on the designated
  493. ResourceManager as <yarn>:
  494. ----
  495. [yarn]$ $HADOOP_YARN_HOME/sbin/yarn-daemon.sh --config $HADOOP_CONF_DIR start resourcemanager
  496. ----
  497. Run a script to start NodeManagers on all slaves as <yarn>:
  498. ----
  499. [yarn]$ $HADOOP_YARN_HOME/sbin/yarn-daemon.sh --config $HADOOP_CONF_DIR start nodemanager
  500. ----
  501. Start a standalone WebAppProxy server. Run on the WebAppProxy
  502. server as <yarn>. If multiple servers are used with load balancing
  503. it should be run on each of them:
  504. ----
  505. [yarn]$ $HADOOP_YARN_HOME/bin/yarn start proxyserver --config $HADOOP_CONF_DIR
  506. ----
  507. Start the MapReduce JobHistory Server with the following command, run on the
  508. designated server as <mapred>:
  509. ----
  510. [mapred]$ $HADOOP_PREFIX/sbin/mr-jobhistory-daemon.sh start historyserver --config $HADOOP_CONF_DIR
  511. ----
  512. ** Hadoop Shutdown
  513. Stop the NameNode with the following command, run on the designated NameNode
  514. as <hdfs>:
  515. ----
  516. [hdfs]$ $HADOOP_PREFIX/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script hdfs stop namenode
  517. ----
  518. Run a script to stop DataNodes on all slaves as <root>:
  519. ----
  520. [root]$ $HADOOP_PREFIX/sbin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script hdfs stop datanode
  521. ----
  522. Stop the ResourceManager with the following command, run on the designated
  523. ResourceManager as <yarn>:
  524. ----
  525. [yarn]$ $HADOOP_YARN_HOME/sbin/yarn-daemon.sh --config $HADOOP_CONF_DIR stop resourcemanager
  526. ----
  527. Run a script to stop NodeManagers on all slaves as <yarn>:
  528. ----
  529. [yarn]$ $HADOOP_YARN_HOME/sbin/yarn-daemon.sh --config $HADOOP_CONF_DIR stop nodemanager
  530. ----
  531. Stop the WebAppProxy server. Run on the WebAppProxy server as
  532. <yarn>. If multiple servers are used with load balancing it
  533. should be run on each of them:
  534. ----
  535. [yarn]$ $HADOOP_YARN_HOME/bin/yarn stop proxyserver --config $HADOOP_CONF_DIR
  536. ----
  537. Stop the MapReduce JobHistory Server with the following command, run on the
  538. designated server as <mapred>:
  539. ----
  540. [mapred]$ $HADOOP_PREFIX/sbin/mr-jobhistory-daemon.sh stop historyserver --config $HADOOP_CONF_DIR
  541. ----
  542. * {Web Interfaces}
  543. Once the Hadoop cluster is up and running check the web-ui of the
  544. components as described below:
  545. *-------------------------+-------------------------+------------------------+
  546. || Daemon || Web Interface || Notes |
  547. *-------------------------+-------------------------+------------------------+
  548. | NameNode | http://<nn_host:port>/ | Default HTTP port is 50070. |
  549. *-------------------------+-------------------------+------------------------+
  550. | ResourceManager | http://<rm_host:port>/ | Default HTTP port is 8088. |
  551. *-------------------------+-------------------------+------------------------+
  552. | MapReduce JobHistory Server | http://<jhs_host:port>/ | |
  553. | | | Default HTTP port is 19888. |
  554. *-------------------------+-------------------------+------------------------+