The two test VMS are rehl 5.3x64. The latest JDK version is installed and SSH password-free logon is correctly set.
Server 1: 192.168.56.101 dev1
Server 2: 192.168.56.102 dev2
Slave. Log on to dev1 and run the following command:
# Cd/usr/software/hadoop
# Tar zxvf hadoop-0.20.1.tar.gz
# Cp-A hadoop-0.20.1/usr/hadoop
# Cd/usr/hadoop/Conf
Modify hadoop environment profile hadoop-env.sh
# Vi hadoop-env.sh
Add the following content:
Export java_home =/usr/Java/jdk1.6.0 _ 16
Modify hadoop main profile core-site.xml
# Vi core-site.xml
Add the following content (which can be customized as needed ):
<? XML version = "1.0"?>
<? XML-stylesheet type = "text/XSL" href = "configuration. XSL"?>
<! -- Put site-specific property overrides in this file. -->
FS. default. name
HDFS: // dev1
the name of the default file system. either the literal string "local" or a host: port for DFS.
hadoop. TMP. dir
/usr/hadoop/tmp
a base for other temporary directories.
DFS. name. dir
/usr/hadoop/filesystem/name
determines where on the local filesystem the DFS Name node shocould store the name table. if this is a comma-delimited list of directories then the name table is replicated in all of the directories, for redundancy.
DFS. data. dir
/usr/hadoop/filesystem/Data
determines where on the local filesystem an DFS data Node shoshould store its blocks. if this is a comma-delimited list of directories, then data will be stored in all named directories, typically on different devices. directories that do not exist are I
gnored.
<Property>
<Name> DFS. Replication </Name>
<Value> 1 </value>
<Description> default block replication. The actual number of replications can be specified when the file is created. The default isused if replication is not specified in create time. </description>
</Property>
</Configuration>
Add hadoop mapred-site.xml files
# Vi mapred-site.xml
Add the following content:
<? XML version = "1.0"?>
<? XML-stylesheet type = "text/XSL" href = "configuration. XSL"?>
<! -- Put site-specific property overrides in this file. -->
<Configuration>
<Property>
<Name> mapred. Job. Tracker </Name>
<Value> dev1: 9001. </value>
<Description>
The host and port that mapreduce job tracker runs at. If "local", then jobs are run in-process as a single map and
Reduce task.
</Description>
</Property>
</Configuration>
Modify the Masters file for hadoop to define namenode:
# Vi masters
Add the following content:
Dev1
Modify the slaves file for hadoop to define datanode:
# Vi slaves
Add the following content:
Dev2
Follow these steps to install hadoop in dev2.
Format namenode:
#./Hadoop namenode-format
All installation and configuration are complete.
Run the following command in dev1 to start hadoop:
# Cd/usr/hadoop/bin
#./Start-all.sh
After the startup is complete, run the following command to view the basic information of hadoop:
#./Hadoop dfsadmin-Report
Or enter http: // 192.168.56.101: 50070/dfshealth. jsp in the browser to view details.