3、配置Java虚拟机
分别在3个机器节点上安装java。
我安装的是jdk-6u25-linux-x64-rpm.bin。
在/home/zhangzk/.bashrc中配置如下环境变量:
export JAVA_HOME=/usr/java/jdk1.6.0_25
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
执行java -version可以看到如下结果则表示成功!
[zhangzk@zhangzk01 software]$ java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)
4、配置Hadoop的配置文件
先在本地修改好hadoop的配置文件,即hadoop-0.21.0\conf下的文件core-site.xml、hdfs-site.xml、mapred-site.xml、masters、slaves内容。
core-site.xml:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration> <property> <name>hadoop.tmp.dir</name> <value>/home/zhangzk/hadoop-0.21.0/hadooptmp</value> </property> <property> <name>fs.default.name</name> <value>hdfs://zhangzk01:9000</value> </property> </configuration>hdfs-site.xml:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration> <property> <name>dfs.name.dir</name> <value>/home/zhangzk/hadoop-0.21.0/hadoopname</value> </property> <property> <name>dfs.data.dir</name> <value>/home/zhangzk/hadoop-0.21.0/hadoopdata</value> </property> <property> <name>dfs.replication</name> <value>2</value> </property> </configuration>mapred-site.xml:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration> <property> <name>mapred.jobtracker.address</name> <value>zhangzk01:9001</value> </property> </configuration>masters:
zhangzk01
slaves:
zhangzk02
zhangzk03