centos6.5 安装hadoop1.2.1的教程详解【亲测版】

2019-10-09 17:05:08于海丽

firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
selinux 同上

8.修改hadoop配置文件

Core-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl" rel="external nofollow" rel="external nofollow" rel="external nofollow" ?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hadoop/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://web-crawler--1.novalocal:9000</value>
</property>
</configuration>
hadoop-env.sh 添加java_home
 export JAVA_HOME=/usr/local/jdk
hdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl" rel="external nofollow" rel="external nofollow" rel="external nofollow" ?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>/home/hadoop/name</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>/home/hadoop/data</value>
</property>
</configuration>
mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl" rel="external nofollow" rel="external nofollow" rel="external nofollow" ?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
 <property>
    <name>mapred.job.tracker</name>
    <value>http://web-crawler--1.novalocal:9001</value>;;;
  </property>
<property>
    <name>mapred.system.dir</name>
    <value>/home/hadoop/mapred/system</value>
  </property>
<property>
    <name>mapred.local.dir</name>
    <value>/home/hadoop/mapred/local</value>
  </property>
</configuration>

5)masters

web-crawler--1.novalocal

6)slaves

web-crawler--1.novalocal
web-crawler--2.novalocal 
web-crawler--3.novalocal

9. 修改环境变量,添加HADOOP_HOME 和JAVA_HOME

Vim /etc/profile (root)
export ANT_HOME=/usr/local/ant
export PATH=${PATH}:${ANT_HOME}/bin
export HADOOP_HOME=/usr/local/hadoop-1.2.1
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
export PATH=/usr/local/lib/phantomjs/bin:$PATH
export ANT_HOME=/usr/local/ant
export PATH=${PATH}:${ANT_HOME}/bin
export PATH=$PATH:${HADOOP_HOME}/bin:${HADOOP_HOME}/sbin

10.启动hadoop