quickstart.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  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.7">
  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. <div class="breadtrail">
  20. <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>
  21. </div>
  22. <div class="header">
  23. <div class="grouplogo">
  24. <a href="http://lucene.apache.org/"><img class="logoImage" alt="Lucene" src="images/lucene_green_150.gif" title="Apache Lucene"></a>
  25. </div>
  26. <div class="projectlogo">
  27. <a href="http://lucene.apache.org/hadoop/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Scalable Computing Platform"></a>
  28. </div>
  29. <div class="searchbox">
  30. <form action="http://www.google.com/search" method="get" class="roundtopsmall">
  31. <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;
  32. <input attr="value" name="Search" value="Search" type="submit">
  33. </form>
  34. </div>
  35. <ul id="tabs">
  36. <li>
  37. <a class="base-not-selected" href="http://lucene.apache.org/hadoop/">Project</a>
  38. </li>
  39. <li>
  40. <a class="base-not-selected" href="http://wiki.apache.org/lucene-hadoop">Wiki</a>
  41. </li>
  42. <li class="current">
  43. <a class="base-selected" href="index.html">Hadoop 0.16 Documentation</a>
  44. </li>
  45. </ul>
  46. </div>
  47. </div>
  48. <div id="main">
  49. <div id="publishedStrip">
  50. <div id="level2tabs"></div>
  51. <script type="text/javascript"><!--
  52. document.write("<text>Last Published:</text> " + document.lastModified);
  53. // --></script>
  54. </div>
  55. <div class="breadtrail">
  56. &nbsp;
  57. </div>
  58. <div id="menu">
  59. <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>
  60. <div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
  61. <div class="menuitem">
  62. <a href="index.html">Overview</a>
  63. </div>
  64. <div class="menupage">
  65. <div class="menupagetitle">Quickstart</div>
  66. </div>
  67. <div class="menuitem">
  68. <a href="cluster_setup.html">Cluster Setup</a>
  69. </div>
  70. <div class="menuitem">
  71. <a href="hdfs_design.html">HDFS Architecture</a>
  72. </div>
  73. <div class="menuitem">
  74. <a href="mapred_tutorial.html">Map-Reduce Tutorial</a>
  75. </div>
  76. <div class="menuitem">
  77. <a href="streaming.html">Streaming</a>
  78. </div>
  79. <div class="menuitem">
  80. <a href="hod.html">Hadoop On Demand</a>
  81. </div>
  82. <div class="menuitem">
  83. <a href="api/index.html">API Docs</a>
  84. </div>
  85. <div class="menuitem">
  86. <a href="http://wiki.apache.org/lucene-hadoop/">Wiki</a>
  87. </div>
  88. <div class="menuitem">
  89. <a href="http://wiki.apache.org/lucene-hadoop/FAQ">FAQ</a>
  90. </div>
  91. <div class="menuitem">
  92. <a href="http://lucene.apache.org/hadoop/mailing_lists.html">Mailing Lists</a>
  93. </div>
  94. </div>
  95. <div id="credit"></div>
  96. <div id="roundbottom">
  97. <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
  98. <div id="credit2"></div>
  99. </div>
  100. <div id="content">
  101. <div title="Portable Document Format" class="pdflink">
  102. <a class="dida" href="quickstart.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
  103. PDF</a>
  104. </div>
  105. <h1>Hadoop Quickstart</h1>
  106. <div id="minitoc-area">
  107. <ul class="minitoc">
  108. <li>
  109. <a href="#Purpose">Purpose</a>
  110. </li>
  111. <li>
  112. <a href="#PreReqs">Pre-requisites</a>
  113. <ul class="minitoc">
  114. <li>
  115. <a href="#Supported+Platforms">Supported Platforms</a>
  116. </li>
  117. <li>
  118. <a href="#Required+Software">Required Software</a>
  119. <ul class="minitoc">
  120. <li>
  121. <a href="#Additional+requirements+for+Windows">Additional requirements for Windows</a>
  122. </li>
  123. </ul>
  124. </li>
  125. <li>
  126. <a href="#Installing+Software">Installing Software</a>
  127. </li>
  128. </ul>
  129. </li>
  130. <li>
  131. <a href="#Download">Download</a>
  132. </li>
  133. <li>
  134. <a href="#Standalone+Operation">Standalone Operation</a>
  135. </li>
  136. <li>
  137. <a href="#SingleNodeSetup">Pseudo-Distributed Operation</a>
  138. <ul class="minitoc">
  139. <li>
  140. <a href="#Configuration">Configuration</a>
  141. </li>
  142. <li>
  143. <a href="#Setup+passphraseless">Setup passphraseless ssh</a>
  144. </li>
  145. <li>
  146. <a href="#Execution">Execution</a>
  147. </li>
  148. </ul>
  149. </li>
  150. <li>
  151. <a href="#Fully-Distributed+Operation">Fully-Distributed Operation</a>
  152. </li>
  153. </ul>
  154. </div>
  155. <a name="N1000C"></a><a name="Purpose"></a>
  156. <h2 class="h3">Purpose</h2>
  157. <div class="section">
  158. <p>The purpose of this document is to help users get a single-node Hadoop
  159. installation up and running very quickly so that users can get a flavour
  160. of the <a href="hdfs_design.html">Hadoop Distributed File System
  161. (<acronym title="Hadoop Distributed File System">HDFS</acronym>)</a> and
  162. the Map-Reduce framework i.e. perform simple operations on HDFS, run
  163. example/simple jobs etc.</p>
  164. </div>
  165. <a name="N1001E"></a><a name="PreReqs"></a>
  166. <h2 class="h3">Pre-requisites</h2>
  167. <div class="section">
  168. <a name="N10024"></a><a name="Supported+Platforms"></a>
  169. <h3 class="h4">Supported Platforms</h3>
  170. <ul>
  171. <li>
  172. Hadoop has been demonstrated on GNU/Linux clusters with 2000 nodes.
  173. </li>
  174. <li>
  175. Win32 is supported as a <em>development platform</em>. Distributed
  176. operation has not been well tested on Win32, so this is not a
  177. <em>production platform</em>.
  178. </li>
  179. </ul>
  180. <a name="N1003A"></a><a name="Required+Software"></a>
  181. <h3 class="h4">Required Software</h3>
  182. <ol>
  183. <li>
  184. Java<sup>TM</sup> 1.5.x, preferably from Sun, must be installed. Set
  185. <span class="codefrag">JAVA_HOME</span> to the root of your Java installation.
  186. </li>
  187. <li>
  188. <strong>ssh</strong> must be installed and <strong>sshd</strong> must
  189. be running to use the Hadoop scripts that manage remote Hadoop
  190. daemons.
  191. </li>
  192. </ol>
  193. <a name="N10055"></a><a name="Additional+requirements+for+Windows"></a>
  194. <h4>Additional requirements for Windows</h4>
  195. <ol>
  196. <li>
  197. <a href="http://www.cygwin.com/">Cygwin</a> - Required for shell
  198. support in addition to the required software above.
  199. </li>
  200. </ol>
  201. <a name="N10067"></a><a name="Installing+Software"></a>
  202. <h3 class="h4">Installing Software</h3>
  203. <p>If your cluster doesn't have the requisite software you will need to
  204. install it.</p>
  205. <p>For example on Ubuntu Linux:</p>
  206. <p>
  207. <span class="codefrag">$ sudo apt-get install ssh</span>
  208. <br>
  209. <span class="codefrag">$ sudo apt-get install rsync</span>
  210. </p>
  211. <p>On Windows, if you did not install the required software when you
  212. installed cygwin, start the cygwin installer and select the packages:</p>
  213. <ul>
  214. <li>openssh - the <em>Net</em> category</li>
  215. </ul>
  216. </div>
  217. <a name="N1008B"></a><a name="Download"></a>
  218. <h2 class="h3">Download</h2>
  219. <div class="section">
  220. <p>
  221. First, you need to get a Hadoop distribution: download a recent
  222. <a href="http://lucene.apache.org/hadoop/releases.html">stable release</a> and unpack it.
  223. </p>
  224. <p>
  225. Once done, in the distribution edit the file
  226. <span class="codefrag">conf/hadoop-env.sh</span> to define at least <span class="codefrag">JAVA_HOME</span>.
  227. </p>
  228. <p>
  229. Try the following command:<br>
  230. <span class="codefrag">$ bin/hadoop</span>
  231. <br>
  232. This will display the usage documentation for the <strong>hadoop</strong>
  233. script.
  234. </p>
  235. </div>
  236. <a name="N100AE"></a><a name="Standalone+Operation"></a>
  237. <h2 class="h3">Standalone Operation</h2>
  238. <div class="section">
  239. <p>By default, Hadoop is configured to run things in a non-distributed
  240. mode, as a single Java process. This is useful for debugging.</p>
  241. <p>
  242. The following example copies the unpacked <span class="codefrag">conf</span> directory to
  243. use as input and then finds and displays every match of the given regular
  244. expression. Output is written to the given <span class="codefrag">output</span> directory.
  245. <br>
  246. <span class="codefrag">$ mkdir input</span>
  247. <br>
  248. <span class="codefrag">$ cp conf/*.xml input</span>
  249. <br>
  250. <span class="codefrag">
  251. $ bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
  252. </span>
  253. <br>
  254. <span class="codefrag">$ cat output/*</span>
  255. </p>
  256. </div>
  257. <a name="N100D2"></a><a name="SingleNodeSetup"></a>
  258. <h2 class="h3">Pseudo-Distributed Operation</h2>
  259. <div class="section">
  260. <p>Hadoop can also be run on a single-node in a pseudo-distributed mode
  261. where each Hadoop daemon runs in a separate Java process.</p>
  262. <a name="N100DB"></a><a name="Configuration"></a>
  263. <h3 class="h4">Configuration</h3>
  264. <p>Use the following <span class="codefrag">conf/hadoop-site.xml</span>:</p>
  265. <table class="ForrestTable" cellspacing="1" cellpadding="4">
  266. <tr>
  267. <td colspan="1" rowspan="1">&lt;configuration&gt;</td>
  268. </tr>
  269. <tr>
  270. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;property&gt;</td>
  271. </tr>
  272. <tr>
  273. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;fs.default.name&lt;/name&gt;</td>
  274. </tr>
  275. <tr>
  276. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;localhost:9000&lt;/value&gt;</td>
  277. </tr>
  278. <tr>
  279. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;/property&gt;</td>
  280. </tr>
  281. <tr>
  282. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;property&gt;</td>
  283. </tr>
  284. <tr>
  285. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;mapred.job.tracker&lt;/name&gt;</td>
  286. </tr>
  287. <tr>
  288. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;localhost:9001&lt;/value&gt;</td>
  289. </tr>
  290. <tr>
  291. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;/property&gt;</td>
  292. </tr>
  293. <tr>
  294. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;property&gt;</td>
  295. </tr>
  296. <tr>
  297. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;dfs.replication&lt;/name&gt;</td>
  298. </tr>
  299. <tr>
  300. <td colspan="1" rowspan="1">&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;1&lt;/value&gt;</td>
  301. </tr>
  302. <tr>
  303. <td colspan="1" rowspan="1">&nbsp;&nbsp;&lt;/property&gt;</td>
  304. </tr>
  305. <tr>
  306. <td colspan="1" rowspan="1">&lt;/configuration&gt;</td>
  307. </tr>
  308. </table>
  309. <a name="N1013F"></a><a name="Setup+passphraseless"></a>
  310. <h3 class="h4">Setup passphraseless ssh</h3>
  311. <p>
  312. Now check that you can ssh to the localhost without a passphrase:<br>
  313. <span class="codefrag">$ ssh localhost</span>
  314. </p>
  315. <p>
  316. If you cannot ssh to localhost without a passphrase, execute the
  317. following commands:<br>
  318. <span class="codefrag">$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa</span>
  319. <br>
  320. <span class="codefrag">$ cat ~/.ssh/id_dsa.pub &gt;&gt; ~/.ssh/authorized_keys</span>
  321. </p>
  322. <a name="N1015C"></a><a name="Execution"></a>
  323. <h3 class="h4">Execution</h3>
  324. <p>
  325. Format a new distributed-filesystem:<br>
  326. <span class="codefrag">$ bin/hadoop namenode -format</span>
  327. </p>
  328. <p>
  329. Start The hadoop daemons:<br>
  330. <span class="codefrag">$ bin/start-all.sh</span>
  331. </p>
  332. <p>The hadoop daemon log output is written to the
  333. <span class="codefrag">${HADOOP_LOG_DIR}</span> directory (defaults to
  334. <span class="codefrag">${HADOOP_HOME}/logs</span>).</p>
  335. <p>Browse the web-interface for the NameNode and the JobTracker, by
  336. default they are available at:</p>
  337. <ul>
  338. <li>
  339. <span class="codefrag">NameNode</span> -
  340. <a href="http://localhost:50070/">http://localhost:50070/</a>
  341. </li>
  342. <li>
  343. <span class="codefrag">JobTracker</span> -
  344. <a href="http://localhost:50030/">http://localhost:50030/</a>
  345. </li>
  346. </ul>
  347. <p>
  348. Copy the input files into the distributed filesystem:<br>
  349. <span class="codefrag">$ bin/hadoop dfs -put conf input</span>
  350. </p>
  351. <p>
  352. Run some of the examples provided:<br>
  353. <span class="codefrag">
  354. $ bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
  355. </span>
  356. </p>
  357. <p>Examine the output files:</p>
  358. <p>
  359. Copy the output files from the distributed filesystem to the local
  360. filesytem and examine them:<br>
  361. <span class="codefrag">$ bin/hadoop dfs -get output output</span>
  362. <br>
  363. <span class="codefrag">$ cat output/*</span>
  364. </p>
  365. <p> or </p>
  366. <p>
  367. View the output files on the distributed filesystem:<br>
  368. <span class="codefrag">$ bin/hadoop dfs -cat output/*</span>
  369. </p>
  370. <p>
  371. When you're done, stop the daemons with:<br>
  372. <span class="codefrag">$ bin/stop-all.sh</span>
  373. </p>
  374. </div>
  375. <a name="N101C9"></a><a name="Fully-Distributed+Operation"></a>
  376. <h2 class="h3">Fully-Distributed Operation</h2>
  377. <div class="section">
  378. <p>Information on setting up fully-distributed non-trivial clusters
  379. can be found <a href="cluster_setup.html">here</a>.</p>
  380. </div>
  381. <p>
  382. <em>Java and JNI are trademarks or registered trademarks of
  383. Sun Microsystems, Inc. in the United States and other countries.</em>
  384. </p>
  385. </div>
  386. <div class="clearboth">&nbsp;</div>
  387. </div>
  388. <div id="footer">
  389. <div class="lastmodified">
  390. <script type="text/javascript"><!--
  391. document.write("<text>Last Published:</text> " + document.lastModified);
  392. // --></script>
  393. </div>
  394. <div class="copyright">
  395. Copyright &copy;
  396. 2007 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
  397. </div>
  398. </div>
  399. </body>
  400. </html>