Please reprint from the source: http://eksliang.iteye.com/blog/2185414
I. Overview
Hadoop has three modes: stand-alone mode, pseudo-distributed mode and fully-distributed mode. Here is a brief introduction to the stand-alone mode. By default, Hadoop is configured in a non-distributed mode and runs JAVA processes independently, which is suitable for debugging.
2. Download address
Hadoop website http://hadoop.apache.org/ OSC address http://www.oschina.net/p/hadoop
Download address: http://www.apache.org/dyn/closer.cgi/hadoop/common/
The downloaded version is hadoop-2.5.2.tar.gz
3. Copy to /usr/hadoop and decompress hadoop
Warm reminder, you must ensure that JDK is installed before installation, because hadoop is written in java and depends on jdk.
[root@localhost hadoop]# pwd /usr/hadoop [root@localhost hadoop]# ls hadoop-2.5.2 hadoop-2.5.2.tar.gz
Fourth, modify the configuration file hadoop-env.sh
The configuration files of Hadoop are all under /usr/hadoop/hadoop-2.5.2/etc/hadoop. Since it is a stand-alone mode by default, the fifth step test example can be directly performed without modification. The following is only the actual modification of the installation. .
Configure JAVA_HOME in hadoop, the default is export JAVA_HOME=${JAVA_HOME} If it was previously configured in the environment variable, you can use the default one without modification.
Fifth, modify the class storage of the java virtual machine
It turned out that the maximum memory configured when the JVM was started was 512m. When running some of the built-in instances of hadoop, it would report a memory overflow. In fact, the memory size can be modified here, and it is not necessary to modify it if it is not needed.
export HADOOP_CLIENT_OPTS="-Xmx256m $HADOOP_CLIENT_OPTS"
6. Run the instance Hello Hadoop
Switch to the installation directory and create two files t1.txt and 2.txt to be uploaded to hadoop
mkdir input cd input echo "hello world" > t1.txt echo "hello hadoop" > t2.txt
Running the wordcount instance that comes with hadoop can count the number of occurrences of words in a batch of text files
./hadoop-2.5.2/bin/hadoop jar /usr/hadoop/hadoop-2.5.2/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5.2.jar wordcount input output
View the results as follows
[root@localhost hadoop]# cat ./output/* hadoop 1 hello 2 world 1
Single machine deployment is that simple!
The original text comes from: http://my.oschina.net/mynote/blog/93340