Stand-alone installation is mainly used for program logic debugging. The installation steps are basically distributed installation, including environment variables, main Hadoop configuration files, SSH configuration, etc. The main difference lies in the configuration file: the slaves configuration needs to be modified. In addition, if dfs.replication is greater than 1 in a distributed installation, it needs to be modified to 1 because there is only 1 datanode.
For distributed installation, please refer to:
http://acooly.iteye.com/blog/1179828
In a stand-alone installation, use one machine, which is the namenode and JobTracker, the datanode and TaskTracker, and of course the SecondaryNameNode.
The main configuration files core-site.xml, hdfs-site.xml, mapred-site.xml, and masters are completely the same as the distribution tree installation configuration. If the number of copies of hdfs-site.xml in the distributed installation configuration scheme is defined to be greater than 1, modify it. is 1.
Copy the code code as follows:
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
The main difference lies in the configuration of slaves. In distributed installation, multiple other machines are used as datanodes. In stand-alone mode, the local machine is the datanode, so modify the slaves configuration file to the domain name of the local machine. For example: the local machine name is hadoop11, then:
[hadoop@hadoop11 ~]$ cat hadoop/conf/slaves
hadoop11
After completing the configuration, start:
Copy the code code as follows:
$ start-all.sh
$ jps
15556Jps
15111 JobTracker
15258 TaskTracker
15014 SecondaryNameNode
14861 DataNode
14712 NameNode
Run DEMO
$ echo word1 word2 word2 word3 word3 word3 > words
$ cat words
word1 word2 word2 word3 word3 word3
$ hadoop dfsadmin -safemode leave
$ hadoop fs -copyFromLocal words /single/input/words
$ hadoop fs -cat /single/input/words
12/02/17 19:47:44 INFO security.Groups: Group mapping impl=org.apache.hadoop.security.ShellBasedUnixGroupsMapping; cacheTimeout=300000
word1 word2 word2 word3 word3 word3
$ hadoop jar hadoop-0.21.0/hadoop-mapred-examples-0.21.0.jar wordcount /single/input /single/output
...
$ hadoop fs -ls /single/output
...
-rw-r--r-- 1 hadoop supergroup 0 2012-02-17 19:50 /single/output/_SUCCESS
-rw-r--r-- 1 hadoop supergroup 24 2012-02-17 19:50 /single/output/part-r-00000
$ hadoop fs -cat /single/output/part-r-00000
...
word1 1
word2 2
word3 3