overview.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <!--
  4. Licensed to the Apache Software Foundation (ASF) under one or more
  5. contributor license agreements. See the NOTICE file distributed with
  6. this work for additional information regarding copyright ownership.
  7. The ASF licenses this file to You under the Apache License, Version 2.0
  8. (the "License"); you may not use this file except in compliance with
  9. the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing, software
  12. distributed under the License is distributed on an "AS IS" BASIS,
  13. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. See the License for the specific language governing permissions and
  15. limitations under the License.
  16. -->
  17. <head>
  18. <title>Hadoop</title>
  19. </head>
  20. <body>
  21. Hadoop is a distributed computing platform.
  22. <p>Hadoop primarily consists of the <a
  23. href="org/apache/hadoop/hdfs/package-summary.html">Hadoop Distributed FileSystem
  24. (HDFS)</a> and an
  25. implementation of the <a href="org/apache/hadoop/mapred/package-summary.html">
  26. Map-Reduce</a> programming paradigm.</p>
  27. <p>Hadoop is a software framework that lets one easily write and run applications
  28. that process vast amounts of data. Here's what makes Hadoop especially useful:</p>
  29. <ul>
  30. <li>
  31. <b>Scalable</b>: Hadoop can reliably store and process petabytes.
  32. </li>
  33. <li>
  34. <b>Economical</b>: It distributes the data and processing across clusters
  35. of commonly available computers. These clusters can number into the thousands
  36. of nodes.
  37. </li>
  38. <li>
  39. <b>Efficient</b>: By distributing the data, Hadoop can process it in parallel
  40. on the nodes where the data is located. This makes it extremely rapid.
  41. </li>
  42. <li>
  43. <b>Reliable</b>: Hadoop automatically maintains multiple copies of data and
  44. automatically redeploys computing tasks based on failures.
  45. </li>
  46. </ul>
  47. <h2>Requirements</h2>
  48. <h3>Platforms</h3>
  49. <ul>
  50. <li>
  51. Hadoop was been demonstrated on GNU/Linux clusters with 2000 nodes.
  52. </li>
  53. <li>
  54. Win32 is supported as a <i>development</i> platform. Distributed operation
  55. has not been well tested on Win32, so this is not a <i>production</i>
  56. platform.
  57. </li>
  58. </ul>
  59. <h3>Requisite Software</h3>
  60. <ol>
  61. <li>
  62. Java 1.6.x, preferably from
  63. <a href="http://java.sun.com/javase/downloads/">Sun</a>.
  64. Set <tt>JAVA_HOME</tt> to the root of your Java installation.
  65. </li>
  66. <li>
  67. ssh must be installed and sshd must be running to use Hadoop's
  68. scripts to manage remote Hadoop daemons.
  69. </li>
  70. <li>
  71. rsync may be installed to use Hadoop's scripts to manage remote
  72. Hadoop installations.
  73. </li>
  74. </ol>
  75. <h4>Additional requirements for Windows</h4>
  76. <ol>
  77. <li>
  78. <a href="http://www.cygwin.com/">Cygwin</a> - Required for shell support in
  79. addition to the required software above.
  80. </li>
  81. </ol>
  82. <h3>Installing Required Software</h3>
  83. <p>If your platform does not have the required software listed above, you
  84. will have to install it.</p>
  85. <p>For example on Ubuntu Linux:</p>
  86. <p><blockquote><pre>
  87. $ sudo apt-get install ssh<br>
  88. $ sudo apt-get install rsync<br>
  89. </pre></blockquote></p>
  90. <p>On Windows, if you did not install the required software when you
  91. installed cygwin, start the cygwin installer and select the packages:</p>
  92. <ul>
  93. <li>openssh - the "Net" category</li>
  94. <li>rsync - the "Net" category</li>
  95. </ul>
  96. <h2>Getting Started</h2>
  97. <p>First, you need to get a copy of the Hadoop code.</p>
  98. <p>Edit the file <tt>conf/hadoop-env.sh</tt> to define at least
  99. <tt>JAVA_HOME</tt>.</p>
  100. <p>Try the following command:</p>
  101. <tt>bin/hadoop</tt>
  102. <p>This will display the documentation for the Hadoop command script.</p>
  103. <h2>Standalone operation</h2>
  104. <p>By default, Hadoop is configured to run things in a non-distributed
  105. mode, as a single Java process. This is useful for debugging, and can
  106. be demonstrated as follows:</p>
  107. <tt>
  108. mkdir input<br>
  109. cp conf/*.xml input<br>
  110. bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'<br>
  111. cat output/*
  112. </tt>
  113. <p>This will display counts for each match of the <a
  114. href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html">
  115. regular expression.</a></p>
  116. <p>Note that input is specified as a <em>directory</em> containing input
  117. files and that output is also specified as a directory where parts are
  118. written.</p>
  119. <h2>Distributed operation</h2>
  120. To configure Hadoop for distributed operation you must specify the
  121. following:
  122. <ol>
  123. <li>The NameNode (Distributed Filesystem master) host. This is
  124. specified with the configuration property <tt><a
  125. href="../core-default.html#fs.default.name">fs.default.name</a></tt>.
  126. </li>
  127. <li>The {@link org.apache.hadoop.mapred.JobTracker} (MapReduce master)
  128. host and port. This is specified with the configuration property
  129. <tt><a
  130. href="../mapred-default.html#mapreduce.jobtracker.address">mapreduce.jobtracker.address</a></tt>.
  131. </li>
  132. <li>A <em>slaves</em> file that lists the names of all the hosts in
  133. the cluster. The default slaves file is <tt>conf/slaves</tt>.
  134. </ol>
  135. <h3>Pseudo-distributed configuration</h3>
  136. You can in fact run everything on a single host. To run things this
  137. way, put the following in:
  138. <br/>
  139. <br/>
  140. conf/core-site.xml:
  141. <xmp><configuration>
  142. <property>
  143. <name>fs.default.name</name>
  144. <value>hdfs://localhost/</value>
  145. </property>
  146. </configuration></xmp>
  147. conf/hdfs-site.xml:
  148. <xmp><configuration>
  149. <property>
  150. <name>dfs.replication</name>
  151. <value>1</value>
  152. </property>
  153. </configuration></xmp>
  154. conf/mapred-site.xml:
  155. <xmp><configuration>
  156. <property>
  157. <name>mapreduce.jobtracker.address</name>
  158. <value>localhost:9001</value>
  159. </property>
  160. </configuration></xmp>
  161. <p>(We also set the HDFS replication level to 1 in order to
  162. reduce warnings when running on a single node.)</p>
  163. <p>Now check that the command <br><tt>ssh localhost</tt><br> does not
  164. require a password. If it does, execute the following commands:</p>
  165. <p><tt>ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa<br>
  166. cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
  167. </tt></p>
  168. <h3>Bootstrapping</h3>
  169. <p>A new distributed filesystem must be formatted with the following
  170. command, run on the master node:</p>
  171. <p><tt>bin/hadoop namenode -format</tt></p>
  172. <p>The Hadoop daemons are started with the following command:</p>
  173. <p><tt>bin/start-all.sh</tt></p>
  174. <p>Daemon log output is written to the <tt>logs/</tt> directory.</p>
  175. <p>Input files are copied into the distributed filesystem as follows:</p>
  176. <p><tt>bin/hadoop fs -put input input</tt></p>
  177. <h3>Distributed execution</h3>
  178. <p>Things are run as before, but output must be copied locally to
  179. examine it:</p>
  180. <tt>
  181. bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'<br>
  182. bin/hadoop fs -get output output
  183. cat output/*
  184. </tt>
  185. <p>When you're done, stop the daemons with:</p>
  186. <p><tt>bin/stop-all.sh</tt></p>
  187. <h3>Fully-distributed operation</h3>
  188. <p>Fully distributed operation is just like the pseudo-distributed operation
  189. described above, except, specify:</p>
  190. <ol>
  191. <li>The hostname or IP address of your master server in the value
  192. for <tt><a
  193. href="../core-default.html#fs.default.name">fs.default.name</a></tt>,
  194. as <tt><em>hdfs://master.example.com/</em></tt> in <tt>conf/core-site.xml</tt>.</li>
  195. <li>The host and port of the your master server in the value
  196. of <tt><a href="../mapred-default.html#mapreduce.jobtracker.address">mapreduce.jobtracker.address</a></tt>
  197. as <tt><em>master.example.com</em>:<em>port</em></tt> in <tt>conf/mapred-site.xml</tt>.</li>
  198. <li>Directories for <tt><a
  199. href="../hdfs-default.html#dfs.name.dir">dfs.name.dir</a></tt> and
  200. <tt><a href="../hdfs-default.html#dfs.data.dir">dfs.data.dir</a>
  201. in <tt>conf/hdfs-site.xml</tt>.
  202. </tt>These are local directories used to hold distributed filesystem
  203. data on the master node and slave nodes respectively. Note
  204. that <tt>dfs.data.dir</tt> may contain a space- or comma-separated
  205. list of directory names, so that data may be stored on multiple local
  206. devices.</li>
  207. <li><tt><a href="../mapred-default.html#mapreduce.cluster.local.dir">mapreduce.cluster.local.dir</a></tt>
  208. in <tt>conf/mapred-site.xml</tt>, the local directory where temporary
  209. MapReduce data is stored. It also may be a list of directories.</li>
  210. <li><tt><a
  211. href="../mapred-default.html#mapreduce.job.maps">mapreduce.job.maps</a></tt>
  212. and <tt><a
  213. href="../mapred-default.html#mapreduce.job.reduces">mapreduce.job.reduces</a></tt>
  214. in <tt>conf/mapred-site.xml</tt>.
  215. As a rule of thumb, use 10x the
  216. number of slave processors for <tt>mapreduce.job.maps</tt>, and 2x the
  217. number of slave processors for <tt>mapreduce.job.reduces</tt>.</li>
  218. </ol>
  219. <p>Finally, list all slave hostnames or IP addresses in your
  220. <tt>conf/slaves</tt> file, one per line. Then format your filesystem
  221. and start your cluster on your master node, as above.
  222. </body>
  223. </html>