分享

hadoop0.23.9虚拟机单机安装配置

ali 2013-12-3 18:23:43 发表于 安装配置 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 6692
抢楼 本帖为抢楼帖,欢迎抢楼! 
hadoop0.23.9虚拟机单机安装
VM9,debian6,jdk1.7,hadoop0.23.9
安装步骤:
0.缺少sudo的需要安装
root@debian:apt-get install sudo
1、安装jdk1.7
root@debian:tar -zxvf jdk-7u45-linux-i586.tar.gz -C /usr/java/
安装完成后路径为/usr/java/jdk1.7.0_45
2、hadoop下载&安装
root@debian:wget http://mirror.esocc.com/apache/hadoop/common/hadoop-0.23.9/hadoop-0.23.9.tar.gz
root@debian:tar zxvf /root/hadoop-0.23.9.tar.gz -C /opt/
root@debian:cd /opt/
root@debian:ln -s hadoop-0.23.9/ hadoop
3、添加hadoop用户权限
root@debian:groupadd hadoop
root@debian:useradd -g hadoop hadoop
root@debian:passwd hadoop
root@debian:vi /etc/sudoers
添加红色部分
root ALL=(ALL) ALL下方添加
hadoop ALL=(ALL:ALL) ALL

4、配置无密码登录
root@debian:su – hadoop
root@debian:ssh-keygen -t rsa -P "自己的密码" 可以是无密码
root@debian:cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
root@debian:chmod 600 ~/.ssh/authorized_keys
测试登录
root@debian:ssh localhost
  如果还是提示输入密码
  确认本机sshd的配置文件(需要root权限)
  root@debian:vi /etc/ssh/sshd_config
  找到以下内容,并去掉注释符”#“
     RSAAuthentication yes
     PubkeyAuthentication yes
     AuthorizedKeysFile     .ssh/authorized_keys
  重启sshd
  root@debian:servicesshd restart

5、配置hadoop
root@debian:chown -R hadoop:hadoop /opt/hadoop
root@debian:chown -R hadoop:hadoop /opt/hadoop-0.23.9
root@debian:su – hadoop
hadoop@debian6-01:~#:vi .bashrc
添加以下部分
export JAVA_HOME=/usr/java/jdk1.7.0_45
export JRE_HOME=${JAVA_HOME}/jre
export HADOOP_HOME=/opt/hadoop
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$HADOOP_HOME/bin:$PATH
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop
root@debian:cd /opt/hadoop/etc/hadoop/
root@debian6-01:/opt/hadoop/etc/hadoop# vi yarn-env.sh
追加以下
export HADOOP_FREFIX=/opt/hadoop
export HADOOP_COMMON_HOME=${HADOOP_FREFIX}
export HADOOP_HDFS_HOME=${HADOOP_FREFIX}
export PATH=$PATH:$HADOOP_FREFIX/bin
export PATH=$PATH:$HADOOP_FREFIX/sbin
export HADOOP_MAPRED_HOME=${HADOOP_FREFIX}
export YARN_HOME=${HADOOP_FREFIX}
export HADOOP_CONF_HOME=${HADOOP_FREFIX}/etc/hadoop
export YARN_CONF_DIR=${HADOOP_FREFIX}/etc/hadoop
root@debian6-01:/opt/hadoop/etc/hadoop# vi core-site.xml
<configuration>
<property>
  <name>fs.defaultFS</name>
  <value>hdfs://localhost:12200</value>
</property>
<property>
  <name>hadoop.tmp.dir</name>
  <value>/opt/hadoop/hadoop-root</value>
</property>
<property>
  <name>fs.arionfs.impl</name>
  <value>org.apache.hadoop.fs.pvfs2.Pvfs2FileSystem</value>
  <description>The FileSystem for arionfs.</description>
</property>
</configuration>
root@debian6-01:/opt/hadoop/etc/hadoop# vi hdfs-site.xml
<configuration>
<property>
  <name>dfs.namenode.name.dir</name>
  <value>file:/opt/hadoop/data/dfs/name</value>
  <final>true</final>
</property>
<property>
  <name>dfs.namenode.data.dir</name>
  <value>file:/opt/hadoop/data/dfs/data</value>
  <final>true</final>
</property>
<property>
  <name>dfs.replication</name>
  <value>1</value>
</property>
<property>
  <name>dfs.permission</name>
  <value>false</value>
</property>
</configuration>
$cp mapred-site.xml.templatemapred-site.xml
root@debian6-01:/opt/hadoop/etc/hadoop# vi mapred-site.xml
<configuration>
    <property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
    </property>
    <property>
        <name>mapreduce.job.tracker</name>
        <value>hdfs://localhost:9001</value>
        <final>true</final>
    </property>
    <property>
        <name>mapreduce.map.memory.mb</name>
        <value>1536</value>
    </property>
    <property>
        <name>mapreduce.map.java.opts</name>
        <value>-Xmx1024M</value>
    </property>
    <property>
        <name>mapreduce.reduce.memory.mb</name>
        <value>3072</value>
    </property>
    <property>
             <name>mapreduce.reduce.java.opts</name>
        <value>-Xmx2560M</value>
    </property>
    <property>
        <name>mapreduce.task.io.sort.mb</name>
        <value>512</value>
    </property>
    <property>
        <name>mapreduce.task.io.sort.factor</name>
        <value>100</value>
    </property>   
    <property>
        <name>mapreduce.reduce.shuffle.parallelcopies</name>
        <value>50</value>
    </property>
    <property>
        <name>mapreduce.system.dir</name>
        <value>file:/opt/hadoop/data/mapred/system</value>
    </property>
    <property>
        <name>mapreduce.local.dir</name>
        <value>file:/opt/hadoop/data/mapred/local</value>
        <final>true</final>
    </property>
</configuration>

root@debian6-01:/opt/hadoop/etc/hadoop# vi yarn-site.xml
<configuration>
<!-- Site specific YARN configuration properties -->
  <property>
    <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce.shuffle</value>
  </property>
  <property>
    <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
    <value>org.apache.hadoop.mapred.ShuffleHandler</value>
  </property>
  <property>
    <name>mapreduce.framework.name</name>
    <value>yarn</value>
  </property>
  <property>
    <name>user.name</name>
    <value>hadoop</value>
  </property>
  <property>
    <name>yarn.resourcemanager.address</name>
    <value>localhost:54311</value>
  </property>
  <property>
    <name>yarn.resourcemanager.scheduler.address</name>
    <value>localhost:54312</value>
  </property>
  <property>
    <name>yarn.resourcemanager.webapp.address</name>
    <value>localhost:54313</value>
  </property>
  <property>
    <name>yarn.resourcemanager.resource-tracker.address</name>
    <value>localhost:54314</value>
  </property>
  <property>
    <name>yarn.web-proxy.address</name>
    <value>localhost:54315</value>
  </property>
  <property>
    <name>mapred.job.tracker</name>
    <value>localhost</value>
       </property>
</configuration>
6、启动并运行wordcount程序
设置JAVA_HOME
root@debian6-01:vi /opt/hadoop/libexec/hadoop-config.sh添加红色部分
# Attempt to set JAVA_HOME if it is not set
export JAVA_HOME=/usr/java/jdk1.7.0_45
if [[ -z $JAVA_HOME ]]; then
格式化namenode
root@debian6-01:/opt/hadoop/lib# hadoop namenode -format
启动
root@debian6-01:/opt/hadoop/sbin/start-dfs.sh
root@debian6-01:/opt/hadoop/sbin/start-yarn.sh
检查
root@debian6-01:jps
6365 SecondaryNameNode
7196 ResourceManager
6066 NameNode
7613 Jps
6188 DataNode
7311 NodeManager
安装成功
如果不能解决问题,请参考Hadoop单机安装配置详细过程http://www.aboutyun.com/thread-5663-1-1.html

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条