将hadoop-0.21.0.tar.gz通过SSH Secure File Transfer Client上传到usr目录下
1、修改/usr/hadoop-0.21.0/conf/目录下的master文件,内容如下:
192.168.1.61
6、修改/usr/hadoop-0.21.0/conf/目录下的slaves文件,内容如下:
192.168.1.62
192.168.1.63
7、修改/usr/hadoop-0.21.0/conf/hadoop-env.sh文件的环境变量:
# The java implementation to use. Required.
export JAVA_HOME=/usr/java/jdk1.6.0_20
8、修改/usr/hadoop-0.21.0/conf/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>/hadoopdata</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://radhat1:9000</value>
<description>The name of the default file system. A URI whose
scheme and authority determine the FileSystem implementation. The
uri's scheme determines the config property (fs.SCHEME.impl) naming
the FileSystem implementation class. The uri's authority is used to
determine the host, port, etc. for a filesystem.</description>
</property>
<property>
<name>dfs.hosts.exclude</name>
<value>excludes</value>
</property>
</configuration>
9、修改/usr/hadoop-0.21.0/conf/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.replication</name>
<value>1</value>
</property>
</configuration>
10、修改/jz/hadoop-0.21.0/conf/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.job.tracker</name>
<value>m131:9001</value>
<description>The host and port that the MapReduce job tracker runs
at. If "local", then jobs are run in-process as a single map
and reduce task.
</description>
</property>
</configuration>
11、修改ect/hosts配置文件,内容如下:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
192.168.1.61 redhat1
192.168.1.62 redhat2
192.168.1.63 redhat3
12、修改/ect/profile配置文件,在末尾追加以下内容,并输入source/etc/profile使之生效:
export JAVA_HOME=/usr/java/jdk1.6.0_20
export JRE_HOME=/usr/java/jdk1.6.0_20/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH
export HADOOP_HOME=/usr/hadoop-0.21.0
export PATH=$HADOOP_HOME/bin:$PATH
export PATH=$PATH:$HIVE_HOME/bin
13、将/usr/hadoop-0.21.0拷贝到192.168.1.62和192.168.1.63对应的目录下。将/ect/profile和/etc/hosts也拷贝到62和63机器上。注意profile需要做生效操作。
三、启动/停止hadoop
1、通过shell脚本启动hadoop。
sh /usr/hadoop-0.21.0/bin/start-all.sh
2、停止hadoop
sh /usr/hadoop-0.21.0/bin/stop-all.sh
或者
hdfs namenode -format
start-dfs.sh
start-mapred.sh
四、初始配置
1、格式化HDFS文件系统。进入/usr/hadoop-0.21.0/bin目录。执行:
hadoop namenode –format
2、在/jz/hadoop-0.21.0/bin目录下,执行:
hadoop fs -ls /
如果控制台返回结果,表示初始化成功。可以向里面录入数据。
3、通过WEB查看hadoop
查看集群状态 | http://192.168.1.61:50070/dfshealth.jsp |
查看JOB状态 | http://192.168.1.61:50030/jobtracker.jsp |
五、注意事项
1、hadoop的安装千万计的修改/etc/hosts文件。修改之后最好是重启机器。
2、master和slaves这2个配置文件可以不拷贝到redhat2和redhat3机器上,只在master上保存即可。
3、通过web查看hadoop的时候,如果使用IE一些图形工具显示不出来,建议使用opera或是chrome。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)