quickstart.html 15 KB

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