MapReduce and MachineLearning——笔记三(配置hadoop环境)

1.安装hadoop

  用hadoop用户登录master节点,直接将hadoop压缩包解压到master节点的/home/hadoop目录下,我安装的的hadoop版本是hadoop-0.20.203.0,解压完毕后进入hadoop-0.20.203.0目录。

2.修改配置文件

2.1 进入conf目录,修改core-site.xml,加入以下内容:

    <property>
<name>fs.default.name</name>
<value>hdfs://master:9000</value>
</property>

<property>
<name>hadoop.tmp.dir</name>
<value>hadoop_work/tmp/</value>
</property>

2.2 修改hdfs-site.xml,加入以下内容:

    <property>
<name>dfs.name.dir</name>
<value>hadoop_work/name/</value>
</property>

<property>
<name>dfs.data.dir</name>
<value>hadoop_work/data/</value>
</property>

<property>
<name>dfs.replication</name>
<value>2</value>
</property>

<property>
<name>dfs.block.size</name>
<value>67108864</value>
</property>

<property>
<name>dfs.permissions</name>
<value>false</value>
</property>

<property>
<name>dfs.web.ugi</name>
<value>hadoop,supergroup</value>
</property>

2.3 修改mapred-site.xml

    <property>
<name>mapred.job.tracker</name>
<value>hdfs://master:9001/</value>
</property>

<property>
<name>mapred.child.java.opts</name>
<value>-Xmx512M</value>
</property>

2.4 修改masters,slaves文件

  在masters里面加入:

  master

  在salves文件中加入:

  slave1

  slave2

2.5 修改hadoop-env.sh

  把JAVA_HOME改成本机的JAVA路径即可

3.将/home/hadoop/hadoop-0.20.203.0目录整个拷贝到另外两台机器
  cd /home/hadoop

  scp -r hadoop-0.20.203.0 hadoop@slave1:~/hadoop-0.20.203.0
  scp -r hadoop-0.20.203.0 hadoop@slave2:~/hadoop-0.20.203.0

4.在master节点格式化DFS

  cd /home/hadoop/hadoop-0.20.203.0

  bin/hadoop namenode -format

5.关闭三台机子的防火墙

  sudo /etc/init.d/iptables stop

6.测试

  进入master的的hadoop-0.20.203.0目录,执行sh bin/start-all.sh

  

posted @ 2011-10-08 16:19  tadoo  阅读(475)  评论(0编辑  收藏  举报