1. core-site.xml
In <configuration> </configuration>, insert
<property> <name>fs.default.name</name> <value>hdfs://localhost:9000</value> </property> <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/home/你自己的用户名/tmp</value> </property>
2. mapred-site.xml
In <configuration> </configuration>, insert
<property> <name>mapred.job.tracker</name> <value>localhost:9001</value></property>
3. format the hadoop file system before running hadoop for the first time.
Go to the file path where hadoop is installed, and enter
Bin/hadoop namenode-format
4. Start hadoop and enter
Bin/start-all.sh
This script is deprecated. Instead use start-dfs.sh and start-yarn.sh
Bash start-dfs.sh (need to configure export java_home)
Bash start-yarn.sh
JPS
Http: // localhost: 50070 (dfshealth)
Http: // localhost: 8088 (cluster metrics)
5. Run wordcount example
1). Create a file
/Home/guan/myword.txt
2) create a hadoop directory
./Bin/hadoop FS-mkdir/Input
3). upload files
./Bin/hadoop FS-put-f/home/guan/myword.txt/Input
4). Execute
./Bin/hadoop jar./share/hadoop/mapreduce/sources/hadoop-mapreduce-examples-2.4.1-sources.jarorg.apache.hadoop.examples.WordCount/Input/Output
5). view the result
./Bin/hadoop FS-CAT/output/part-r-00000
Hadoop 2.4 pseudo-distributed mode