1.install ubuntu l0.04 LTS version
2.update,upgrade and install ssh
#apt-get update
#apt-get upgrade
#apt-get install ssh
3.install sun-6-java jdk
#apt-get install openjdk-6-java
4.create new user hadoop and group
#addgroup hadoop
#adduser --ingroup hadoop hadoop
5.generate ssh key to auto login to manager all nodes
#ssh-keygen -t rsa -P ""
6.disable ipv6 and reboot machine
#vim /etc/modprobe.d/blacklist
add new line in it
blacklist ipv6
7.download hadoop from mirror site
#wget http://XXX.XXX.XXX.XXX/hadoop-0.21.0.tar.gz
8.untar hadoop-0.21.0.tar.gz and rename it to hadoop
#tar zxvf hadoop-0.21.0.tar.gz
#mv hadoop-0.21.0
9.change owner and group to hadoop on hadoop folder
#chown -R hadoop:hadoop hadoop/
10.confirm java home folder
#ls -l `whereis javac`
11.modify hadoop home folder hadoop-env.sh
#vim hadoop/conf/hadoop-env.sh
uncomment export JAVA_HOME and modify it
export JAVA_HOME = /usr/lib/jvm/java-6-openjdk/
12.config hadoop config file
#vim hadoop/conf/core-site.xml
add these line into it
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hadoop/hadoop/tmp/dir/hadoop-hadoop</value>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://10.124.2.225</value>
</property>
13.config hadoop file with hdfs-site.xml
#vim hadoop/conf/hdfs-site.xml
add these line into it
<property>
<name>dfs.replication</name>
<value>1</value>
<property>
14.config hadoop file with mapred-site.xml
#vim hadoop/conf/mapred-site.xml
add these line into it
<property>
<name>mapred.job.tracker</name>
<value>10.124.2.225:54311</value>
</property>
15.formating the namenode
#hadoop/bin/hadoop namenode -format
16.start cluster
#hadoop/bin/start-all.sh
17.check hadoop process
#hadoop/bin/jps
18.use netstat to check all service running status
#netstat -plten | grep java
19.stop cluster
#hadoop/bin/stop-all.sh
20.start cluster
#hadoop/bin/start-all.sh
21.mkdir a folder for gutenberg and touch three files with contents
#mkdir /tmp/gutenberg
#cd /tmp/gutenberg
#vim 1.txt
#vim 2.txt
#vim 3.txt
21.use hadoop fs copyFromLocal copy files to hdfs folder
#hadoop/bin/hadoop fs -copyFromLocal /tmp/gutenberg gutenber
22.check hdfs folder content
#hadoop/bin/hadoop fs -ls
#hadoop/bin/hadoop fs -ls gutenberg
23.use java wordcount to calculate the words number
#hadoop/bin/hadoop jar hadoop-mapred-examples-0.21.0.jar wordcount gutenberg gutenberg-output
24.list gutenberg-output folder content
#bin/hadoop fs -ls gutenberg-output
25.mkdir one subfolder on folder tmp
#mkdir /tmp/gutenberg-output
26.copy data from hdfs to local folder
# bin/hadoop fs -copyToLocal gutenberg-output/part-r-00000 /tmp/gutenberg-output/
27.show content for part-r-000000
#more /tmp/gutenberg-content/part-r-00000
沒有留言:
張貼留言