SingleNodeSetup.apt.vm 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. ~~ Licensed under the Apache License, Version 2.0 (the "License");
  2. ~~ you may not use this file except in compliance with the License.
  3. ~~ You may obtain a copy of the License at
  4. ~~
  5. ~~ http://www.apache.org/licenses/LICENSE-2.0
  6. ~~
  7. ~~ Unless required by applicable law or agreed to in writing, software
  8. ~~ distributed under the License is distributed on an "AS IS" BASIS,
  9. ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. ~~ See the License for the specific language governing permissions and
  11. ~~ limitations under the License. See accompanying LICENSE file.
  12. ---
  13. Single Node Setup
  14. ---
  15. ---
  16. ${maven.build.timestamp}
  17. Single Node Setup
  18. %{toc|section=1|fromDepth=0}
  19. * Purpose
  20. This document describes how to set up and configure a single-node
  21. Hadoop installation so that you can quickly perform simple operations
  22. using Hadoop MapReduce and the Hadoop Distributed File System (HDFS).
  23. * Prerequisites
  24. ** Supported Platforms
  25. * GNU/Linux is supported as a development and production platform.
  26. Hadoop has been demonstrated on GNU/Linux clusters with 2000 nodes.
  27. * Windows is also a supported platform.
  28. ** Required Software
  29. Required software for Linux and Windows include:
  30. [[1]] Java^TM 1.6.x, preferably from Sun, must be installed.
  31. [[2]] ssh must be installed and sshd must be running to use the Hadoop
  32. scripts that manage remote Hadoop daemons.
  33. ** Installing Software
  34. If your cluster doesn't have the requisite software you will need to
  35. install it.
  36. For example on Ubuntu Linux:
  37. ----
  38. $ sudo apt-get install ssh
  39. $ sudo apt-get install rsync
  40. ----
  41. * Download
  42. To get a Hadoop distribution, download a recent stable release from one
  43. of the Apache Download Mirrors.
  44. * Prepare to Start the Hadoop Cluster
  45. Unpack the downloaded Hadoop distribution. In the distribution, edit
  46. the file <<<conf/hadoop-env.sh>>> to define at least <<<JAVA_HOME>>> to be the root
  47. of your Java installation.
  48. Try the following command:
  49. ----
  50. $ bin/hadoop
  51. ----
  52. This will display the usage documentation for the hadoop script.
  53. Now you are ready to start your Hadoop cluster in one of the three
  54. supported modes:
  55. * Local (Standalone) Mode
  56. * Pseudo-Distributed Mode
  57. * Fully-Distributed Mode
  58. * Standalone Operation
  59. By default, Hadoop is configured to run in a non-distributed mode, as a
  60. single Java process. This is useful for debugging.
  61. The following example copies the unpacked conf directory to use as
  62. input and then finds and displays every match of the given regular
  63. expression. Output is written to the given output directory.
  64. ----
  65. $ mkdir input
  66. $ cp conf/*.xml input
  67. $ bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
  68. $ cat output/*
  69. ---
  70. * Pseudo-Distributed Operation
  71. Hadoop can also be run on a single-node in a pseudo-distributed mode
  72. where each Hadoop daemon runs in a separate Java process.
  73. ** Configuration
  74. Use the following:
  75. conf/core-site.xml:
  76. ----
  77. <configuration>
  78. <property>
  79. <name>fs.defaultFS</name>
  80. <value>hdfs://localhost:9000</value>
  81. </property>
  82. </configuration>
  83. ----
  84. conf/hdfs-site.xml:
  85. ----
  86. <configuration>
  87. <property>
  88. <name>dfs.replication</name>
  89. <value>1</value>
  90. </property>
  91. </configuration>
  92. ----
  93. conf/mapred-site.xml:
  94. ----
  95. <configuration>
  96. <property>
  97. <name>mapred.job.tracker</name>
  98. <value>localhost:9001</value>
  99. </property>
  100. </configuration>
  101. ----
  102. ** Setup passphraseless ssh
  103. Now check that you can ssh to the localhost without a passphrase:
  104. ----
  105. $ ssh localhost
  106. ----
  107. If you cannot ssh to localhost without a passphrase, execute the
  108. following commands:
  109. ----
  110. $ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
  111. $ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
  112. ----
  113. ** Execution
  114. Format a new distributed-filesystem:
  115. ----
  116. $ bin/hadoop namenode -format
  117. ----
  118. Start the hadoop daemons:
  119. ----
  120. $ bin/start-all.sh
  121. ----
  122. The hadoop daemon log output is written to the <<<${HADOOP_LOG_DIR}>>>
  123. directory (defaults to <<<${HADOOP_PREFIX}/logs>>>).
  124. Browse the web interface for the NameNode and the JobTracker; by
  125. default they are available at:
  126. * NameNode - <<<http://localhost:50070/>>>
  127. * JobTracker - <<<http://localhost:50030/>>>
  128. Copy the input files into the distributed filesystem:
  129. ----
  130. $ bin/hadoop fs -put conf input
  131. ----
  132. Run some of the examples provided:
  133. ----
  134. $ bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
  135. ----
  136. Examine the output files:
  137. Copy the output files from the distributed filesystem to the local
  138. filesytem and examine them:
  139. ----
  140. $ bin/hadoop fs -get output output
  141. $ cat output/*
  142. ----
  143. or
  144. View the output files on the distributed filesystem:
  145. ----
  146. $ bin/hadoop fs -cat output/*
  147. ----
  148. When you're done, stop the daemons with:
  149. ----
  150. $ bin/stop-all.sh
  151. ----
  152. * Fully-Distributed Operation
  153. For information on setting up fully-distributed, non-trivial clusters
  154. see {{{Cluster Setup}}}.
  155. Java and JNI are trademarks or registered trademarks of Sun
  156. Microsystems, Inc. in the United States and other countries.