這篇文章主要介紹VM9+Debian6+hadoop0.23.9如何實現(xiàn)單點安裝,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
成都創(chuàng)新互聯(lián)主營寧化網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,App定制開發(fā),寧化h5微信平臺小程序開發(fā)搭建,寧化網(wǎng)站營銷推廣歡迎寧化等地區(qū)企業(yè)咨詢
一、環(huán)境準備
1.1 Debian 6,安裝時根據(jù)提示安裝SSH;(如果是window中模擬,可先安裝VMware,本人選擇的是VMware workstation 9)
1.2 jdk1.7,hadoop0.23.9:下載位置http://mirror.esocc.com/apache/hadoop/common/hadoop-0.23.9/hadoop-0.23.9.tar.gz
二、安裝過程
2.1 為Debian安裝sudo
root@debian:apt-get install sudo
2.2 安裝jdk1.7
先通過SSH客戶端將jdk-7u45-linux-i586.tar.gz傳到/root/路徑下,然后執(zhí)行下面命令
root@debian~:tar -zxvf jdk-7u45-linux-i586.tar.gz -C /usr/java/
2.3 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 hadoop-0.23.9.tar.gz -C /opt/ root@debian~:cd /opt/ root@debian:/opt/# ln -s hadoop-0.23.9/ hadoop
----------這里做了個hadoop0.23.9的映射,相當于windows下面的.link
2.4 添加hadoop用戶權(quán)限
root@debian~:groupadd hadoop root@debian~:useradd -g hadoop hadoop root@debian~:passwd hadoop root@debian~:vi /etc/sudoers
sudoers中添加hadoop用戶權(quán)限
root ALL=(ALL) ALL下方添加
hadoop ALL=(ALL:ALL) ALL
2.5 配置SSH登錄
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
如果想設(shè)置空密碼登錄,還是提示輸入密碼的話,確認本機sshd的配置文件(需要root權(quán)限)
root @debian :vi /etc/ssh/sshd_config
找到以下內(nèi)容,并去掉注釋符”#“
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
然后重啟sshd,不想設(shè)置空密碼登錄的不用重啟
root @debian :servicesshd restart
2.6 配置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//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
root@debian6-01:/opt/hadoop/etc/hadoop# vi hdfs-site.xml
root@debian6-01:/opt/hadoop/etc/hadoop#cp mapred-site.xml.templatemapred-site.xml root@debian6-01:/opt/hadoop/etc/hadoop# vi mapred-site.xml
root@debian6-01:/opt/hadoop/etc/hadoop# vi yarn-site.xml
2.7 啟動并運行wordcount程序
設(shè)置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 -------:wq!保存退出
格式化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
以上是“VM9+Debian6+hadoop0.23.9如何實現(xiàn)單點安裝”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!