cluster_setup.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta content="Apache Forrest" name="Generator">
  6. <meta name="Forrest-version" content="0.8">
  7. <meta name="Forrest-skin-name" content="pelt">
  8. <title>Hadoop Cluster Setup</title>
  9. <link type="text/css" href="skin/basic.css" rel="stylesheet">
  10. <link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
  11. <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
  12. <link type="text/css" href="skin/profile.css" rel="stylesheet">
  13. <script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
  14. <link rel="shortcut icon" href="images/favicon.ico">
  15. </head>
  16. <body onload="init()">
  17. <script type="text/javascript">ndeSetTextSize();</script>
  18. <div id="top">
  19. <!--+
  20. |breadtrail
  21. +-->
  22. <div class="breadtrail">
  23. <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a> &gt; <a href="http://hadoop.apache.org/core/">Core</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
  24. </div>
  25. <!--+
  26. |header
  27. +-->
  28. <div class="header">
  29. <!--+
  30. |start group logo
  31. +-->
  32. <div class="grouplogo">
  33. <a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
  34. </div>
  35. <!--+
  36. |end group logo
  37. +-->
  38. <!--+
  39. |start Project Logo
  40. +-->
  41. <div class="projectlogo">
  42. <a href="http://hadoop.apache.org/core/"><img class="logoImage" alt="Hadoop" src="images/core-logo.gif" title="Scalable Computing Platform"></a>
  43. </div>
  44. <!--+
  45. |end Project Logo
  46. +-->
  47. <!--+
  48. |start Search
  49. +-->
  50. <div class="searchbox">
  51. <form action="http://www.google.com/search" method="get" class="roundtopsmall">
  52. <input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp;
  53. <input name="Search" value="Search" type="submit">
  54. </form>
  55. </div>
  56. <!--+
  57. |end search
  58. +-->
  59. <!--+
  60. |start Tabs
  61. +-->
  62. <ul id="tabs">
  63. <li>
  64. <a class="unselected" href="http://hadoop.apache.org/core/">Project</a>
  65. </li>
  66. <li>
  67. <a class="unselected" href="http://wiki.apache.org/hadoop">Wiki</a>
  68. </li>
  69. <li class="current">
  70. <a class="selected" href="index.html">Hadoop 0.17 Documentation</a>
  71. </li>
  72. </ul>
  73. <!--+
  74. |end Tabs
  75. +-->
  76. </div>
  77. </div>
  78. <div id="main">
  79. <div id="publishedStrip">
  80. <!--+
  81. |start Subtabs
  82. +-->
  83. <div id="level2tabs"></div>
  84. <!--+
  85. |end Endtabs
  86. +-->
  87. <script type="text/javascript"><!--
  88. document.write("Last Published: " + document.lastModified);
  89. // --></script>
  90. </div>
  91. <!--+
  92. |breadtrail
  93. +-->
  94. <div class="breadtrail">
  95. &nbsp;
  96. </div>
  97. <!--+
  98. |start Menu, mainarea
  99. +-->
  100. <!--+
  101. |start Menu
  102. +-->
  103. <div id="menu">
  104. <div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Documentation</div>
  105. <div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
  106. <div class="menuitem">
  107. <a href="index.html">Overview</a>
  108. </div>
  109. <div class="menuitem">
  110. <a href="quickstart.html">Quickstart</a>
  111. </div>
  112. <div class="menupage">
  113. <div class="menupagetitle">Cluster Setup</div>
  114. </div>
  115. <div class="menuitem">
  116. <a href="hdfs_design.html">HDFS Architecture</a>
  117. </div>
  118. <div class="menuitem">
  119. <a href="hdfs_user_guide.html">HDFS User Guide</a>
  120. </div>
  121. <div class="menuitem">
  122. <a href="hdfs_shell.html">HDFS Shell Guide</a>
  123. </div>
  124. <div class="menuitem">
  125. <a href="hdfs_permissions_guide.html">HDFS Permissions Guide</a>
  126. </div>
  127. <div class="menuitem">
  128. <a href="mapred_tutorial.html">Map-Reduce Tutorial</a>
  129. </div>
  130. <div class="menuitem">
  131. <a href="native_libraries.html">Native Hadoop Libraries</a>
  132. </div>
  133. <div class="menuitem">
  134. <a href="streaming.html">Streaming</a>
  135. </div>
  136. <div class="menuitem">
  137. <a href="hod.html">Hadoop On Demand</a>
  138. </div>
  139. <div class="menuitem">
  140. <a href="api/index.html">API Docs</a>
  141. </div>
  142. <div class="menuitem">
  143. <a href="http://wiki.apache.org/hadoop/">Wiki</a>
  144. </div>
  145. <div class="menuitem">
  146. <a href="http://wiki.apache.org/hadoop/FAQ">FAQ</a>
  147. </div>
  148. <div class="menuitem">
  149. <a href="http://hadoop.apache.org/core/mailing_lists.html">Mailing Lists</a>
  150. </div>
  151. <div class="menuitem">
  152. <a href="releasenotes.html">Release Notes</a>
  153. </div>
  154. <div class="menuitem">
  155. <a href="changes.html">All Changes</a>
  156. </div>
  157. </div>
  158. <div id="credit"></div>
  159. <div id="roundbottom">
  160. <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
  161. <!--+
  162. |alternative credits
  163. +-->
  164. <div id="credit2"></div>
  165. </div>
  166. <!--+
  167. |end Menu
  168. +-->
  169. <!--+
  170. |start content
  171. +-->
  172. <div id="content">
  173. <div title="Portable Document Format" class="pdflink">
  174. <a class="dida" href="cluster_setup.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
  175. PDF</a>
  176. </div>
  177. <h1>Hadoop Cluster Setup</h1>
  178. <div id="minitoc-area">
  179. <ul class="minitoc">
  180. <li>
  181. <a href="#Purpose">Purpose</a>
  182. </li>
  183. <li>
  184. <a href="#Pre-requisites">Pre-requisites</a>
  185. </li>
  186. <li>
  187. <a href="#Installation">Installation</a>
  188. </li>
  189. <li>
  190. <a href="#Configuration">Configuration</a>
  191. <ul class="minitoc">
  192. <li>
  193. <a href="#Configuration+Files">Configuration Files</a>
  194. </li>
  195. <li>
  196. <a href="#Site+Configuration">Site Configuration</a>
  197. <ul class="minitoc">
  198. <li>
  199. <a href="#Configuring+the+Environment+of+the+Hadoop+Daemons">Configuring the Environment of the Hadoop Daemons</a>
  200. </li>
  201. <li>
  202. <a href="#Configuring+the+Hadoop+Daemons">Configuring the Hadoop Daemons</a>
  203. </li>
  204. <li>
  205. <a href="#Slaves">Slaves</a>
  206. </li>
  207. <li>
  208. <a href="#Logging">Logging</a>
  209. </li>
  210. </ul>
  211. </li>
  212. </ul>
  213. </li>
  214. <li>
  215. <a href="#Hadoop+Rack+Awareness">Hadoop Rack Awareness</a>
  216. </li>
  217. <li>
  218. <a href="#Hadoop+Startup">Hadoop Startup</a>
  219. </li>
  220. <li>
  221. <a href="#Hadoop+Shutdown">Hadoop Shutdown</a>
  222. </li>
  223. </ul>
  224. </div>
  225. <a name="N1000D"></a><a name="Purpose"></a>
  226. <h2 class="h3">Purpose</h2>
  227. <div class="section">
  228. <p>This document describes how to install, configure and manage non-trivial
  229. Hadoop clusters ranging from a few nodes to extremely large clusters with
  230. thousands of nodes.</p>
  231. <p>If you are looking to install Hadoop on a single machine to play
  232. with it, you can find relevant details <a href="quickstart.html">here</a>.
  233. </p>
  234. </div>
  235. <a name="N1001E"></a><a name="Pre-requisites"></a>
  236. <h2 class="h3">Pre-requisites</h2>
  237. <div class="section">
  238. <ol>
  239. <li>
  240. Make sure all <a href="quickstart.html#PreReqs">requisite</a> software
  241. is installed on all nodes in your cluster.
  242. </li>
  243. <li>
  244. <a href="quickstart.html#Download">Get</a> the Hadoop software.
  245. </li>
  246. </ol>
  247. </div>
  248. <a name="N10036"></a><a name="Installation"></a>
  249. <h2 class="h3">Installation</h2>
  250. <div class="section">
  251. <p>Installing a Hadoop cluster typically involves unpacking the software
  252. on all the machines in the cluster.</p>
  253. <p>Typically one machine in the cluster is designated as the
  254. <span class="codefrag">NameNode</span> and another machine the as <span class="codefrag">JobTracker</span>,
  255. exclusively. These are the <em>masters</em>. The rest of the machines in
  256. the cluster act as both <span class="codefrag">DataNode</span> <em>and</em>
  257. <span class="codefrag">TaskTracker</span>. These are the <em>slaves</em>.</p>
  258. <p>The root of the distribution is referred to as
  259. <span class="codefrag">HADOOP_HOME</span>. All machines in the cluster usually have the same
  260. <span class="codefrag">HADOOP_HOME</span> path.</p>
  261. </div>
  262. <a name="N10061"></a><a name="Configuration"></a>
  263. <h2 class="h3">Configuration</h2>
  264. <div class="section">
  265. <p>The following sections describe how to configure a Hadoop cluster.</p>
  266. <a name="N1006A"></a><a name="Configuration+Files"></a>
  267. <h3 class="h4">Configuration Files</h3>
  268. <p>Hadoop configuration is driven by two important configuration files
  269. found in the <span class="codefrag">conf/</span> directory of the distribution:</p>
  270. <ol>
  271. <li>
  272. <a href="http://hadoop.apache.org/core/docs/current/hadoop-default.html">hadoop-default.xml</a> - Read-only
  273. default configuration.
  274. </li>
  275. <li>
  276. <em>hadoop-site.xml</em> - Site-specific configuration.
  277. </li>
  278. </ol>
  279. <p>To learn more about how the Hadoop framework is controlled by these
  280. configuration files, look
  281. <a href="api/org/apache/hadoop/conf/Configuration.html">here</a>.</p>
  282. <p>Additionally, you can control the Hadoop scripts found in the
  283. <span class="codefrag">bin/</span> directory of the distribution, by setting site-specific
  284. values via the <span class="codefrag">conf/hadoop-env.sh</span>.</p>
  285. <a name="N10097"></a><a name="Site+Configuration"></a>
  286. <h3 class="h4">Site Configuration</h3>
  287. <p>To configure the the Hadoop cluster you will need to configure the
  288. <em>environment</em> in which the Hadoop daemons execute as well as
  289. the <em>configuration parameters</em> for the Hadoop daemons.</p>
  290. <p>The Hadoop daemons are <span class="codefrag">NameNode</span>/<span class="codefrag">DataNode</span>
  291. and <span class="codefrag">JobTracker</span>/<span class="codefrag">TaskTracker</span>.</p>
  292. <a name="N100B5"></a><a name="Configuring+the+Environment+of+the+Hadoop+Daemons"></a>
  293. <h4>Configuring the Environment of the Hadoop Daemons</h4>
  294. <p>Administrators should use the <span class="codefrag">conf/hadoop-env.sh</span> script
  295. to do site-specific customization of the Hadoop daemons' process
  296. environment.</p>
  297. <p>At the very least you should specify the
  298. <span class="codefrag">JAVA_HOME</span> so that it is correctly defined on each
  299. remote node.</p>
  300. <p>Other useful configuration parameters that you can customize
  301. include:</p>
  302. <ul>
  303. <li>
  304. <span class="codefrag">HADOOP_LOG_DIR</span> - The directory where the daemons'
  305. log files are stored. They are automatically created if they don't
  306. exist.
  307. </li>
  308. <li>
  309. <span class="codefrag">HADOOP_HEAPSIZE</span> - The maximum amount of heapsize
  310. to use, in MB e.g. <span class="codefrag">2000MB</span>.
  311. </li>
  312. </ul>
  313. <a name="N100DD"></a><a name="Configuring+the+Hadoop+Daemons"></a>
  314. <h4>Configuring the Hadoop Daemons</h4>
  315. <p>This section deals with important parameters to be specified in the
  316. <span class="codefrag">conf/hadoop-site.xml</span> for the Hadoop cluster.</p>
  317. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  318. <tr>
  319. <th colspan="1" rowspan="1">Parameter</th>
  320. <th colspan="1" rowspan="1">Value</th>
  321. <th colspan="1" rowspan="1">Notes</th>
  322. </tr>
  323. <tr>
  324. <td colspan="1" rowspan="1">fs.default.name</td>
  325. <td colspan="1" rowspan="1">Hostname or IP address of <span class="codefrag">NameNode</span>.</td>
  326. <td colspan="1" rowspan="1"><em>host:port</em> pair.</td>
  327. </tr>
  328. <tr>
  329. <td colspan="1" rowspan="1">mapred.job.tracker</td>
  330. <td colspan="1" rowspan="1">Hostname or IP address of <span class="codefrag">JobTracker</span>.</td>
  331. <td colspan="1" rowspan="1"><em>host:port</em> pair.</td>
  332. </tr>
  333. <tr>
  334. <td colspan="1" rowspan="1">dfs.name.dir</td>
  335. <td colspan="1" rowspan="1">
  336. Path on the local filesystem where the <span class="codefrag">NameNode</span>
  337. stores the namespace and transactions logs persistently.</td>
  338. <td colspan="1" rowspan="1">
  339. If this is a comma-delimited list of directories then the name
  340. table is replicated in all of the directories, for redundancy.
  341. </td>
  342. </tr>
  343. <tr>
  344. <td colspan="1" rowspan="1">dfs.data.dir</td>
  345. <td colspan="1" rowspan="1">
  346. Comma separated list of paths on the local filesystem of a
  347. <span class="codefrag">DataNode</span> where it should store its blocks.
  348. </td>
  349. <td colspan="1" rowspan="1">
  350. If this is a comma-delimited list of directories, then data will
  351. be stored in all named directories, typically on different
  352. devices.
  353. </td>
  354. </tr>
  355. <tr>
  356. <td colspan="1" rowspan="1">mapred.system.dir</td>
  357. <td colspan="1" rowspan="1">
  358. Path on the HDFS where where the Map-Reduce framework stores
  359. system files e.g. <span class="codefrag">/hadoop/mapred/system/</span>.
  360. </td>
  361. <td colspan="1" rowspan="1">
  362. This is in the default filesystem (HDFS) and must be accessible
  363. from both the server and client machines.
  364. </td>
  365. </tr>
  366. <tr>
  367. <td colspan="1" rowspan="1">mapred.local.dir</td>
  368. <td colspan="1" rowspan="1">
  369. Comma-separated list of paths on the local filesystem where
  370. temporary Map-Reduce data is written.
  371. </td>
  372. <td colspan="1" rowspan="1">Multiple paths help spread disk i/o.</td>
  373. </tr>
  374. <tr>
  375. <td colspan="1" rowspan="1">mapred.tasktracker.{map|reduce}.tasks.maximum</td>
  376. <td colspan="1" rowspan="1">
  377. The maximum number of map/reduce tasks, which are run
  378. simultaneously on a given <span class="codefrag">TaskTracker</span>, individually.
  379. </td>
  380. <td colspan="1" rowspan="1">
  381. Defaults to 2 (2 maps and 2 reduces), but vary it depending on
  382. your hardware.
  383. </td>
  384. </tr>
  385. <tr>
  386. <td colspan="1" rowspan="1">dfs.hosts/dfs.hosts.exclude</td>
  387. <td colspan="1" rowspan="1">List of permitted/excluded DataNodes.</td>
  388. <td colspan="1" rowspan="1">
  389. If necessary, use these files to control the list of allowable
  390. datanodes.
  391. </td>
  392. </tr>
  393. <tr>
  394. <td colspan="1" rowspan="1">mapred.hosts/mapred.hosts.exclude</td>
  395. <td colspan="1" rowspan="1">List of permitted/excluded TaskTrackers.</td>
  396. <td colspan="1" rowspan="1">
  397. If necessary, use these files to control the list of allowable
  398. tasktrackers.
  399. </td>
  400. </tr>
  401. </table>
  402. <p>Typically all the above parameters are marked as
  403. <a href="api/org/apache/hadoop/conf/Configuration.html#FinalParams">
  404. final</a> to ensure that they cannot be overriden by user-applications.
  405. </p>
  406. <a name="N101BD"></a><a name="Real-World+Cluster+Configurations"></a>
  407. <h5>Real-World Cluster Configurations</h5>
  408. <p>This section lists some non-default configuration parameters which
  409. have been used to run the <em>sort</em> benchmark on very large
  410. clusters.</p>
  411. <ul>
  412. <li>
  413. <p>Some non-default configuration values used to run sort900,
  414. that is 9TB of data sorted on a cluster with 900 nodes:</p>
  415. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  416. <tr>
  417. <th colspan="1" rowspan="1">Parameter</th>
  418. <th colspan="1" rowspan="1">Value</th>
  419. <th colspan="1" rowspan="1">Notes</th>
  420. </tr>
  421. <tr>
  422. <td colspan="1" rowspan="1">dfs.block.size</td>
  423. <td colspan="1" rowspan="1">134217728</td>
  424. <td colspan="1" rowspan="1">HDFS blocksize of 128MB for large file-systems.</td>
  425. </tr>
  426. <tr>
  427. <td colspan="1" rowspan="1">dfs.namenode.handler.count</td>
  428. <td colspan="1" rowspan="1">40</td>
  429. <td colspan="1" rowspan="1">
  430. More NameNode server threads to handle RPCs from large
  431. number of DataNodes.
  432. </td>
  433. </tr>
  434. <tr>
  435. <td colspan="1" rowspan="1">mapred.reduce.parallel.copies</td>
  436. <td colspan="1" rowspan="1">20</td>
  437. <td colspan="1" rowspan="1">
  438. Higher number of parallel copies run by reduces to fetch
  439. outputs from very large number of maps.
  440. </td>
  441. </tr>
  442. <tr>
  443. <td colspan="1" rowspan="1">mapred.child.java.opts</td>
  444. <td colspan="1" rowspan="1">-Xmx512M</td>
  445. <td colspan="1" rowspan="1">
  446. Larger heap-size for child jvms of maps/reduces.
  447. </td>
  448. </tr>
  449. <tr>
  450. <td colspan="1" rowspan="1">fs.inmemory.size.mb</td>
  451. <td colspan="1" rowspan="1">200</td>
  452. <td colspan="1" rowspan="1">
  453. Larger amount of memory allocated for the in-memory
  454. file-system used to merge map-outputs at the reduces.
  455. </td>
  456. </tr>
  457. <tr>
  458. <td colspan="1" rowspan="1">io.sort.factor</td>
  459. <td colspan="1" rowspan="1">100</td>
  460. <td colspan="1" rowspan="1">More streams merged at once while sorting files.</td>
  461. </tr>
  462. <tr>
  463. <td colspan="1" rowspan="1">io.sort.mb</td>
  464. <td colspan="1" rowspan="1">200</td>
  465. <td colspan="1" rowspan="1">Higher memory-limit while sorting data.</td>
  466. </tr>
  467. <tr>
  468. <td colspan="1" rowspan="1">io.file.buffer.size</td>
  469. <td colspan="1" rowspan="1">131072</td>
  470. <td colspan="1" rowspan="1">Size of read/write buffer used in SequenceFiles.</td>
  471. </tr>
  472. </table>
  473. </li>
  474. <li>
  475. <p>Updates to some configuration values to run sort1400 and
  476. sort2000, that is 14TB of data sorted on 1400 nodes and 20TB of
  477. data sorted on 2000 nodes:</p>
  478. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  479. <tr>
  480. <th colspan="1" rowspan="1">Parameter</th>
  481. <th colspan="1" rowspan="1">Value</th>
  482. <th colspan="1" rowspan="1">Notes</th>
  483. </tr>
  484. <tr>
  485. <td colspan="1" rowspan="1">mapred.job.tracker.handler.count</td>
  486. <td colspan="1" rowspan="1">60</td>
  487. <td colspan="1" rowspan="1">
  488. More JobTracker server threads to handle RPCs from large
  489. number of TaskTrackers.
  490. </td>
  491. </tr>
  492. <tr>
  493. <td colspan="1" rowspan="1">mapred.reduce.parallel.copies</td>
  494. <td colspan="1" rowspan="1">50</td>
  495. <td colspan="1" rowspan="1"></td>
  496. </tr>
  497. <tr>
  498. <td colspan="1" rowspan="1">tasktracker.http.threads</td>
  499. <td colspan="1" rowspan="1">50</td>
  500. <td colspan="1" rowspan="1">
  501. More worker threads for the TaskTracker's http server. The
  502. http server is used by reduces to fetch intermediate
  503. map-outputs.
  504. </td>
  505. </tr>
  506. <tr>
  507. <td colspan="1" rowspan="1">mapred.child.java.opts</td>
  508. <td colspan="1" rowspan="1">-Xmx1024M</td>
  509. <td colspan="1" rowspan="1"></td>
  510. </tr>
  511. </table>
  512. </li>
  513. </ul>
  514. <a name="N102DA"></a><a name="Slaves"></a>
  515. <h4>Slaves</h4>
  516. <p>Typically you choose one machine in the cluster to act as the
  517. <span class="codefrag">NameNode</span> and one machine as to act as the
  518. <span class="codefrag">JobTracker</span>, exclusively. The rest of the machines act as
  519. both a <span class="codefrag">DataNode</span> and <span class="codefrag">TaskTracker</span> and are
  520. referred to as <em>slaves</em>.</p>
  521. <p>List all slave hostnames or IP addresses in your
  522. <span class="codefrag">conf/slaves</span> file, one per line.</p>
  523. <a name="N102F9"></a><a name="Logging"></a>
  524. <h4>Logging</h4>
  525. <p>Hadoop uses the <a href="http://logging.apache.org/log4j/">Apache
  526. log4j</a> via the <a href="http://commons.apache.org/logging/">Apache
  527. Commons Logging</a> framework for logging. Edit the
  528. <span class="codefrag">conf/log4j.properties</span> file to customize the Hadoop
  529. daemons' logging configuration (log-formats and so on).</p>
  530. <a name="N1030D"></a><a name="History+Logging"></a>
  531. <h5>History Logging</h5>
  532. <p> The job history files are stored in central location
  533. <span class="codefrag"> hadoop.job.history.location </span> which can be on DFS also,
  534. whose default value is <span class="codefrag">${HADOOP_LOG_DIR}/history</span>.
  535. The history web UI is accessible from job tracker web UI.</p>
  536. <p> The history files are also logged to user specified directory
  537. <span class="codefrag">hadoop.job.history.user.location</span>
  538. which defaults to job output directory. The files are stored in
  539. "_logs/history/" in the specified directory. Hence, by default
  540. they will be in "mapred.output.dir/_logs/history/". User can stop
  541. logging by giving the value <span class="codefrag">none</span> for
  542. <span class="codefrag">hadoop.job.history.user.location</span>
  543. </p>
  544. <p> User can view the history logs summary in specified directory
  545. using the following command <br>
  546. <span class="codefrag">$ bin/hadoop job -history output-dir</span>
  547. <br>
  548. This command will print job details, failed and killed tip
  549. details. <br>
  550. More details about the job such as successful tasks and
  551. task attempts made for each task can be viewed using the
  552. following command <br>
  553. <span class="codefrag">$ bin/hadoop job -history all output-dir</span>
  554. <br>
  555. </p>
  556. <p>Once all the necessary configuration is complete, distribute the files
  557. to the <span class="codefrag">HADOOP_CONF_DIR</span> directory on all the machines,
  558. typically <span class="codefrag">${HADOOP_HOME}/conf</span>.</p>
  559. </div>
  560. <a name="N10345"></a><a name="Hadoop+Rack+Awareness"></a>
  561. <h2 class="h3">Hadoop Rack Awareness</h2>
  562. <div class="section">
  563. <p>The HDFS and the Map-Reduce components are rack-aware.</p>
  564. <p>The <span class="codefrag">NameNode</span> and the <span class="codefrag">JobTracker</span> obtains the
  565. <span class="codefrag">rack id</span> of the slaves in the cluster by invoking an API
  566. <a href="api/org/apache/hadoop/net/DNSToSwitchMapping.html#resolve(java.util.List)">resolve</a> in an administrator configured
  567. module. The API resolves the slave's DNS name (also IP address) to a
  568. rack id. What module to use can be configured using the configuration
  569. item <span class="codefrag">topology.node.switch.mapping.impl</span>. The default
  570. implementation of the same runs a script/command configured using
  571. <span class="codefrag">topology.script.file.name</span>. If topology.script.file.name is
  572. not set, the rack id <span class="codefrag">/default-rack</span> is returned for any
  573. passed IP address. The additional configuration in the Map-Reduce
  574. part is <span class="codefrag">mapred.cache.task.levels</span> which determines the number
  575. of levels (in the network topology) of caches. So, for example, if it is
  576. the default value of 2, two levels of caches will be constructed -
  577. one for hosts (host -&gt; task mapping) and another for racks
  578. (rack -&gt; task mapping).
  579. </p>
  580. </div>
  581. <a name="N1036B"></a><a name="Hadoop+Startup"></a>
  582. <h2 class="h3">Hadoop Startup</h2>
  583. <div class="section">
  584. <p>To start a Hadoop cluster you will need to start both the HDFS and
  585. Map-Reduce cluster.</p>
  586. <p>
  587. Format a new distributed filesystem:<br>
  588. <span class="codefrag">$ bin/hadoop namenode -format</span>
  589. </p>
  590. <p>
  591. Start the HDFS with the following command, run on the designated
  592. <span class="codefrag">NameNode</span>:<br>
  593. <span class="codefrag">$ bin/start-dfs.sh</span>
  594. </p>
  595. <p>The <span class="codefrag">bin/start-dfs.sh</span> script also consults the
  596. <span class="codefrag">${HADOOP_CONF_DIR}/slaves</span> file on the <span class="codefrag">NameNode</span>
  597. and starts the <span class="codefrag">DataNode</span> daemon on all the listed slaves.</p>
  598. <p>
  599. Start Map-Reduce with the following command, run on the designated
  600. <span class="codefrag">JobTracker</span>:<br>
  601. <span class="codefrag">$ bin/start-mapred.sh</span>
  602. </p>
  603. <p>The <span class="codefrag">bin/start-mapred.sh</span> script also consults the
  604. <span class="codefrag">${HADOOP_CONF_DIR}/slaves</span> file on the <span class="codefrag">JobTracker</span>
  605. and starts the <span class="codefrag">TaskTracker</span> daemon on all the listed slaves.
  606. </p>
  607. </div>
  608. <a name="N103B1"></a><a name="Hadoop+Shutdown"></a>
  609. <h2 class="h3">Hadoop Shutdown</h2>
  610. <div class="section">
  611. <p>
  612. Stop HDFS with the following command, run on the designated
  613. <span class="codefrag">NameNode</span>:<br>
  614. <span class="codefrag">$ bin/stop-dfs.sh</span>
  615. </p>
  616. <p>The <span class="codefrag">bin/stop-dfs.sh</span> script also consults the
  617. <span class="codefrag">${HADOOP_CONF_DIR}/slaves</span> file on the <span class="codefrag">NameNode</span>
  618. and stops the <span class="codefrag">DataNode</span> daemon on all the listed slaves.</p>
  619. <p>
  620. Stop Map-Reduce with the following command, run on the designated
  621. the designated <span class="codefrag">JobTracker</span>:<br>
  622. <span class="codefrag">$ bin/stop-mapred.sh</span>
  623. <br>
  624. </p>
  625. <p>The <span class="codefrag">bin/stop-mapred.sh</span> script also consults the
  626. <span class="codefrag">${HADOOP_CONF_DIR}/slaves</span> file on the <span class="codefrag">JobTracker</span>
  627. and stops the <span class="codefrag">TaskTracker</span> daemon on all the listed slaves.</p>
  628. </div>
  629. </div>
  630. <!--+
  631. |end content
  632. +-->
  633. <div class="clearboth">&nbsp;</div>
  634. </div>
  635. <div id="footer">
  636. <!--+
  637. |start bottomstrip
  638. +-->
  639. <div class="lastmodified">
  640. <script type="text/javascript"><!--
  641. document.write("Last Published: " + document.lastModified);
  642. // --></script>
  643. </div>
  644. <div class="copyright">
  645. Copyright &copy;
  646. 2007 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
  647. </div>
  648. <!--+
  649. |end bottomstrip
  650. +-->
  651. </div>
  652. </body>
  653. </html>