quickstart.html 16 KB

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