主頁(yè) > 知識(shí)庫(kù) > centos6.5 安裝hadoop1.2.1的教程詳解【親測(cè)版】

centos6.5 安裝hadoop1.2.1的教程詳解【親測(cè)版】

熱門標(biāo)簽:電銷機(jī)器人價(jià)值 大連400電話如何申請(qǐng) 如何分析地圖標(biāo)注 外呼系統(tǒng)坐席費(fèi)計(jì)入會(huì)計(jì)哪個(gè)科目 電銷機(jī)器人怎么接線路 撫順地圖標(biāo)注 新余高德地圖標(biāo)注怎么修改 高德地圖標(biāo)注好做嗎 達(dá)亞電銷機(jī)器人官網(wǎng)

本篇只簡(jiǎn)單介紹安裝步驟

 1. 角色分配

10.11.84.4 web-crawler--1.novalocal master/slave
10.11.84.5 web-crawler--2.novalocal slave
10.11.84.6 web-crawler--3.novalocal slave

2.安裝目錄 /usr/local/hadoop (HADOOP_HOME)

3,創(chuàng)建group hadoop

groupadd hadoop

4.創(chuàng)建用戶hadoop

useradd -d /home/hadoop -g hadoop hadoop
chown -R hadoop:hadoop /usr/local/hadoop

5. 每臺(tái)機(jī)器安裝jdk(安裝在相同的目錄)

1)查看java 版本,可以看到j(luò)dk為openjdk,最好更換為sun jdk

[hadoop@hadoop2 ~]$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
[hadoop@hadoop2 ~]$ rpm -qa | grep java
java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64
javapackages-tools-3.4.1-11.el7.noarch
tzdata-java-2017b-1.el7.noarch
java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.5.el7.x86_64
java-1.7.0-openjdk-1.7.0.141-2.6.10.5.el7.x86_64
java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64
python-javapackages-3.4.1-11.el7.noarch

2)卸載openjdk

rpm -qa | grep java | xargs yum -y remove

3)安裝sunjdk

/usr/local 目錄下解壓jdk-8u181-linux-i586.tar.gz 并命名為jdk

配置環(huán)境變量如下

vim /etc/profile  末尾添加如下內(nèi)容

export JAVA_HOME=/usr/local/jdk
export JRE_HOME=${JAVA_HOME}/jre
export PATH=${JAVA_HOME}/bin:${PATH}
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:${CLASSPATH} 

4)查看jdk是否安裝成功

[root@hadoop2 local]# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

6. master 到 slave ssh 免密碼登錄

在每臺(tái)機(jī)器hadoop用戶下執(zhí)行如下命令

[hadoop@hadoop1 ~]$ ssh-keygen -t rsa -P '' #一路直接回車
發(fā)送master 機(jī)器~/.ssh/id_rsa.pub 到所有slave節(jié)點(diǎn)
Scp id_rsa.pub hadoop@10.11.84.5:~
Scp id_rsa.pub hadoop@10.11.84.6:~
讓后在每臺(tái)slave節(jié)點(diǎn)hadoop 用戶下執(zhí)行如下命令
Cd ~/.ssh
Cat ../id_rsa.pub >> authorized_keys
Chmod 644 authorized_keys

7.關(guān)閉所有機(jī)器防火墻、selinux

1)centos 7 以下

防火墻
查看防火墻狀態(tài)
service iptables status
臨時(shí)關(guān)閉防火墻
service iptables stop
永久關(guān)閉防火墻
chkconfig iptables off
 selinux
setenforce 0 #臨時(shí)關(guān)閉
永久關(guān)閉需要修改如下文件
vim /etc/selinux/config
將SELINUX=enforcing改為SELINUX=disabled

2)centos 7

firewall-cmd --reload #重啟firewall
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開(kāi)機(jī)啟動(dòng)
firewall-cmd --state #查看默認(rèn)防火墻狀態(tài)(關(guān)閉后顯示notrunning,開(kāi)啟后顯示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. 修改環(huán)境變量,添加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.啟動(dòng)hadoop

1)在master上format namenode

hadoop namenode -format

2)啟動(dòng)hadoop

sh /user/local/hadoop/bin/start-all.sh 

11.進(jìn)行簡(jiǎn)單測(cè)試

Hadoop fs -mkdir -p /user/hadoop/private/in
Hadoop fs -put /user/local/hadoop/bin/start-all.sh /user/hadoop/private/in
Cd /usr/local/hadoop
Hadoop jar hadoop-examples-1.2.1.jar wordcount /user/hadoop/private/in /user/hadoop/private/out

總結(jié)

以上所述是小編給大家介紹的centos6.5 安裝hadoop1.2.1的教程詳解,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

標(biāo)簽:黃石 湖南 楊凌 南通 海東 新鄉(xiāng) 遼源 衡水

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《centos6.5 安裝hadoop1.2.1的教程詳解【親測(cè)版】》,本文關(guān)鍵詞  centos6.5,安裝,hadoop1.2.1,的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《centos6.5 安裝hadoop1.2.1的教程詳解【親測(cè)版】》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于centos6.5 安裝hadoop1.2.1的教程詳解【親測(cè)版】的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章