quickstart.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  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 Quick Start</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.19 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="menupage">
  110. <div class="menupagetitle">Hadoop Quick Start</div>
  111. </div>
  112. <div class="menuitem">
  113. <a href="cluster_setup.html">Hadoop Cluster Setup</a>
  114. </div>
  115. <div class="menuitem">
  116. <a href="mapred_tutorial.html">Hadoop Map/Reduce Tutorial</a>
  117. </div>
  118. <div class="menuitem">
  119. <a href="commands_manual.html">Hadoop Command Guide</a>
  120. </div>
  121. <div class="menuitem">
  122. <a href="hdfs_shell.html">Hadoop FS Shell Guide</a>
  123. </div>
  124. <div class="menuitem">
  125. <a href="distcp.html">Hadoop DistCp Guide</a>
  126. </div>
  127. <div class="menuitem">
  128. <a href="native_libraries.html">Hadoop Native Libraries</a>
  129. </div>
  130. <div class="menuitem">
  131. <a href="streaming.html">Hadoop Streaming</a>
  132. </div>
  133. <div class="menuitem">
  134. <a href="hadoop_archives.html">Hadoop Archives</a>
  135. </div>
  136. <div class="menuitem">
  137. <a href="hdfs_user_guide.html">HDFS User Guide</a>
  138. </div>
  139. <div class="menuitem">
  140. <a href="hdfs_design.html">HDFS Architecture</a>
  141. </div>
  142. <div class="menuitem">
  143. <a href="hdfs_permissions_guide.html">HDFS Admin Guide: Permissions</a>
  144. </div>
  145. <div class="menuitem">
  146. <a href="hdfs_quota_admin_guide.html">HDFS Admin Guide: Quotas</a>
  147. </div>
  148. <div class="menuitem">
  149. <a href="SLG_user_guide.html">HDFS Utilities</a>
  150. </div>
  151. <div class="menuitem">
  152. <a href="hod_user_guide.html">HOD User Guide</a>
  153. </div>
  154. <div class="menuitem">
  155. <a href="hod_admin_guide.html">HOD Admin Guide</a>
  156. </div>
  157. <div class="menuitem">
  158. <a href="hod_config_guide.html">HOD Config Guide</a>
  159. </div>
  160. <div class="menuitem">
  161. <a href="capacity_scheduler.html">Capacity Scheduler</a>
  162. </div>
  163. <div class="menuitem">
  164. <a href="api/index.html">API Docs</a>
  165. </div>
  166. <div class="menuitem">
  167. <a href="jdiff/changes.html">API Changes</a>
  168. </div>
  169. <div class="menuitem">
  170. <a href="http://wiki.apache.org/hadoop/">Wiki</a>
  171. </div>
  172. <div class="menuitem">
  173. <a href="http://wiki.apache.org/hadoop/FAQ">FAQ</a>
  174. </div>
  175. <div class="menuitem">
  176. <a href="releasenotes.html">Release Notes</a>
  177. </div>
  178. <div class="menuitem">
  179. <a href="changes.html">Change Log</a>
  180. </div>
  181. </div>
  182. <div id="credit"></div>
  183. <div id="roundbottom">
  184. <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
  185. <!--+
  186. |alternative credits
  187. +-->
  188. <div id="credit2"></div>
  189. </div>
  190. <!--+
  191. |end Menu
  192. +-->
  193. <!--+
  194. |start content
  195. +-->
  196. <div id="content">
  197. <div title="Portable Document Format" class="pdflink">
  198. <a class="dida" href="quickstart.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
  199. PDF</a>
  200. </div>
  201. <h1>Hadoop Quick Start</h1>
  202. <div id="minitoc-area">
  203. <ul class="minitoc">
  204. <li>
  205. <a href="#Purpose">Purpose</a>
  206. </li>
  207. <li>
  208. <a href="#PreReqs">Pre-requisites</a>
  209. <ul class="minitoc">
  210. <li>
  211. <a href="#Supported+Platforms">Supported Platforms</a>
  212. </li>
  213. <li>
  214. <a href="#Required+Software">Required Software</a>
  215. </li>
  216. <li>
  217. <a href="#Installing+Software">Installing Software</a>
  218. </li>
  219. </ul>
  220. </li>
  221. <li>
  222. <a href="#Download">Download</a>
  223. </li>
  224. <li>
  225. <a href="#Prepare+to+Start+the+Hadoop+Cluster">Prepare to Start the Hadoop Cluster</a>
  226. </li>
  227. <li>
  228. <a href="#Local">Standalone Operation</a>
  229. </li>
  230. <li>
  231. <a href="#PseudoDistributed">Pseudo-Distributed Operation</a>
  232. <ul class="minitoc">
  233. <li>
  234. <a href="#Configuration">Configuration</a>
  235. </li>
  236. <li>
  237. <a href="#Setup+passphraseless">Setup passphraseless ssh</a>
  238. </li>
  239. <li>
  240. <a href="#Execution">Execution</a>
  241. </li>
  242. </ul>
  243. </li>
  244. <li>
  245. <a href="#FullyDistributed">Fully-Distributed Operation</a>
  246. </li>
  247. </ul>
  248. </div>
  249. <a name="N1000D"></a><a name="Purpose"></a>
  250. <h2 class="h3">Purpose</h2>
  251. <div class="section">
  252. <p>The purpose of this document is to help you get a single-node Hadoop
  253. installation up and running very quickly so that you can get a flavour
  254. of the Hadoop Distributed File System
  255. (see <a href="hdfs_design.html"> <acronym title="Hadoop Distributed File System">HDFS</acronym> Architecture</a>) and
  256. the Map/Reduce framework; that is, perform simple operations on HDFS and
  257. run example jobs.</p>
  258. </div>
  259. <a name="N1001F"></a><a name="PreReqs"></a>
  260. <h2 class="h3">Pre-requisites</h2>
  261. <div class="section">
  262. <a name="N10025"></a><a name="Supported+Platforms"></a>
  263. <h3 class="h4">Supported Platforms</h3>
  264. <ul>
  265. <li>
  266. GNU/Linux is supported as a development and production platform.
  267. Hadoop has been demonstrated on GNU/Linux clusters with 2000 nodes.
  268. </li>
  269. <li>
  270. Win32 is supported as a <em>development platform</em>. Distributed
  271. operation has not been well tested on Win32, so it is not
  272. supported as a <em>production platform</em>.
  273. </li>
  274. </ul>
  275. <a name="N1003B"></a><a name="Required+Software"></a>
  276. <h3 class="h4">Required Software</h3>
  277. <p>Required software for Linux and Windows include:</p>
  278. <ol>
  279. <li>
  280. Java<sup>TM</sup> 1.6.x, preferably from Sun, must be installed.
  281. </li>
  282. <li>
  283. <strong>ssh</strong> must be installed and <strong>sshd</strong> must
  284. be running to use the Hadoop scripts that manage remote Hadoop
  285. daemons.
  286. </li>
  287. </ol>
  288. <p>Additional requirements for Windows include:</p>
  289. <ol>
  290. <li>
  291. <a href="http://www.cygwin.com/">Cygwin</a> - Required for shell
  292. support in addition to the required software above.
  293. </li>
  294. </ol>
  295. <a name="N10064"></a><a name="Installing+Software"></a>
  296. <h3 class="h4">Installing Software</h3>
  297. <p>If your cluster doesn't have the requisite software you will need to
  298. install it.</p>
  299. <p>For example on Ubuntu Linux:</p>
  300. <p>
  301. <span class="codefrag">$ sudo apt-get install ssh</span>
  302. <br>
  303. <span class="codefrag">$ sudo apt-get install rsync</span>
  304. </p>
  305. <p>On Windows, if you did not install the required software when you
  306. installed cygwin, start the cygwin installer and select the packages:</p>
  307. <ul>
  308. <li>openssh - the <em>Net</em> category</li>
  309. </ul>
  310. </div>
  311. <a name="N10088"></a><a name="Download"></a>
  312. <h2 class="h3">Download</h2>
  313. <div class="section">
  314. <p>
  315. To get a Hadoop distribution, download a recent
  316. <a href="http://hadoop.apache.org/core/releases.html">stable release</a> from one of the Apache Download
  317. Mirrors.
  318. </p>
  319. </div>
  320. <a name="N10096"></a><a name="Prepare+to+Start+the+Hadoop+Cluster"></a>
  321. <h2 class="h3">Prepare to Start the Hadoop Cluster</h2>
  322. <div class="section">
  323. <p>
  324. Unpack the downloaded Hadoop distribution. In the distribution, edit the
  325. file <span class="codefrag">conf/hadoop-env.sh</span> to define at least
  326. <span class="codefrag">JAVA_HOME</span> to be the root of your Java installation.
  327. </p>
  328. <p>
  329. Try the following command:<br>
  330. <span class="codefrag">$ bin/hadoop</span>
  331. <br>
  332. This will display the usage documentation for the <strong>hadoop</strong>
  333. script.
  334. </p>
  335. <p>Now you are ready to start your Hadoop cluster in one of the three supported
  336. modes:
  337. </p>
  338. <ul>
  339. <li>Local (Standalone) Mode</li>
  340. <li>Pseudo-Distributed Mode</li>
  341. <li>Fully-Distributed Mode</li>
  342. </ul>
  343. </div>
  344. <a name="N100C1"></a><a name="Local"></a>
  345. <h2 class="h3">Standalone Operation</h2>
  346. <div class="section">
  347. <p>By default, Hadoop is configured to run in a non-distributed
  348. mode, as a single Java process. This is useful for debugging.</p>
  349. <p>
  350. The following example copies the unpacked <span class="codefrag">conf</span> directory to
  351. use as input and then finds and displays every match of the given regular
  352. expression. Output is written to the given <span class="codefrag">output</span> directory.
  353. <br>
  354. <span class="codefrag">$ mkdir input</span>
  355. <br>
  356. <span class="codefrag">$ cp conf/*.xml input</span>
  357. <br>
  358. <span class="codefrag">
  359. $ bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
  360. </span>
  361. <br>
  362. <span class="codefrag">$ cat output/*</span>
  363. </p>
  364. </div>
  365. <a name="N100E5"></a><a name="PseudoDistributed"></a>
  366. <h2 class="h3">Pseudo-Distributed Operation</h2>
  367. <div class="section">
  368. <p>Hadoop can also be run on a single-node in a pseudo-distributed mode
  369. where each Hadoop daemon runs in a separate Java process.</p>
  370. <a name="N100EE"></a><a name="Configuration"></a>
  371. <h3 class="h4">Configuration</h3>
  372. <p>Use the following <span class="codefrag">conf/hadoop-site.xml</span>:</p>
  373. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  374. <tr>
  375. <td colspan="1" rowspan="1">&lt;configuration&gt;</td>
  376. </tr>
  377. <tr>
  378. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;property&gt;</td>
  379. </tr>
  380. <tr>
  381. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;fs.default.name&lt;/name&gt;</td>
  382. </tr>
  383. <tr>
  384. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;hdfs://localhost:9000&lt;/value&gt;</td>
  385. </tr>
  386. <tr>
  387. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;/property&gt;</td>
  388. </tr>
  389. <tr>
  390. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;property&gt;</td>
  391. </tr>
  392. <tr>
  393. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;mapred.job.tracker&lt;/name&gt;</td>
  394. </tr>
  395. <tr>
  396. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;localhost:9001&lt;/value&gt;</td>
  397. </tr>
  398. <tr>
  399. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;/property&gt;</td>
  400. </tr>
  401. <tr>
  402. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;property&gt;</td>
  403. </tr>
  404. <tr>
  405. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;dfs.replication&lt;/name&gt;</td>
  406. </tr>
  407. <tr>
  408. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;1&lt;/value&gt;</td>
  409. </tr>
  410. <tr>
  411. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;/property&gt;</td>
  412. </tr>
  413. <tr>
  414. <td colspan="1" rowspan="1">&lt;/configuration&gt;</td>
  415. </tr>
  416. </table>
  417. <a name="N10152"></a><a name="Setup+passphraseless"></a>
  418. <h3 class="h4">Setup passphraseless ssh</h3>
  419. <p>
  420. Now check that you can ssh to the localhost without a passphrase:<br>
  421. <span class="codefrag">$ ssh localhost</span>
  422. </p>
  423. <p>
  424. If you cannot ssh to localhost without a passphrase, execute the
  425. following commands:<br>
  426. <span class="codefrag">$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa</span>
  427. <br>
  428. <span class="codefrag">$ cat ~/.ssh/id_dsa.pub &gt;&gt; ~/.ssh/authorized_keys</span>
  429. </p>
  430. <a name="N1016F"></a><a name="Execution"></a>
  431. <h3 class="h4">Execution</h3>
  432. <p>
  433. Format a new distributed-filesystem:<br>
  434. <span class="codefrag">$ bin/hadoop namenode -format</span>
  435. </p>
  436. <p>
  437. Start the hadoop daemons:<br>
  438. <span class="codefrag">$ bin/start-all.sh</span>
  439. </p>
  440. <p>The hadoop daemon log output is written to the
  441. <span class="codefrag">${HADOOP_LOG_DIR}</span> directory (defaults to
  442. <span class="codefrag">${HADOOP_HOME}/logs</span>).</p>
  443. <p>Browse the web interface for the NameNode and the JobTracker; by
  444. default they are available at:</p>
  445. <ul>
  446. <li>
  447. <span class="codefrag">NameNode</span> -
  448. <a href="http://localhost:50070/">http://localhost:50070/</a>
  449. </li>
  450. <li>
  451. <span class="codefrag">JobTracker</span> -
  452. <a href="http://localhost:50030/">http://localhost:50030/</a>
  453. </li>
  454. </ul>
  455. <p>
  456. Copy the input files into the distributed filesystem:<br>
  457. <span class="codefrag">$ bin/hadoop fs -put conf input</span>
  458. </p>
  459. <p>
  460. Run some of the examples provided:<br>
  461. <span class="codefrag">
  462. $ bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
  463. </span>
  464. </p>
  465. <p>Examine the output files:</p>
  466. <p>
  467. Copy the output files from the distributed filesystem to the local
  468. filesytem and examine them:<br>
  469. <span class="codefrag">$ bin/hadoop fs -get output output</span>
  470. <br>
  471. <span class="codefrag">$ cat output/*</span>
  472. </p>
  473. <p> or </p>
  474. <p>
  475. View the output files on the distributed filesystem:<br>
  476. <span class="codefrag">$ bin/hadoop fs -cat output/*</span>
  477. </p>
  478. <p>
  479. When you're done, stop the daemons with:<br>
  480. <span class="codefrag">$ bin/stop-all.sh</span>
  481. </p>
  482. </div>
  483. <a name="N101DC"></a><a name="FullyDistributed"></a>
  484. <h2 class="h3">Fully-Distributed Operation</h2>
  485. <div class="section">
  486. <p>For information on setting up fully-distributed, non-trivial clusters
  487. see <a href="cluster_setup.html">Hadoop Cluster Setup</a>.</p>
  488. </div>
  489. <p>
  490. <em>Java and JNI are trademarks or registered trademarks of
  491. Sun Microsystems, Inc. in the United States and other countries.</em>
  492. </p>
  493. </div>
  494. <!--+
  495. |end content
  496. +-->
  497. <div class="clearboth">&nbsp;</div>
  498. </div>
  499. <div id="footer">
  500. <!--+
  501. |start bottomstrip
  502. +-->
  503. <div class="lastmodified">
  504. <script type="text/javascript"><!--
  505. document.write("Last Published: " + document.lastModified);
  506. // --></script>
  507. </div>
  508. <div class="copyright">
  509. Copyright &copy;
  510. 2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
  511. </div>
  512. <!--+
  513. |end bottomstrip
  514. +-->
  515. </div>
  516. </body>
  517. </html>