真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

hadoop-2.3.0-cdh5.1.0完全分布式集群配置及HA配置的示例分析

這篇文章主要介紹了hadoop-2.3.0-cdh5.1.0完全分布式集群配置及HA配置的示例分析,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

超過(guò)十多年行業(yè)經(jīng)驗(yàn),技術(shù)領(lǐng)先,服務(wù)至上的經(jīng)營(yíng)模式,全靠網(wǎng)絡(luò)和口碑獲得客戶(hù),為自己降低成本,也就是為客戶(hù)降低成本。到目前業(yè)務(wù)范圍包括了:成都做網(wǎng)站、成都網(wǎng)站設(shè)計(jì),成都網(wǎng)站推廣,成都網(wǎng)站優(yōu)化,整體網(wǎng)絡(luò)托管,小程序定制開(kāi)發(fā),微信開(kāi)發(fā),重慶App定制開(kāi)發(fā),同時(shí)也可以讓客戶(hù)的網(wǎng)站和網(wǎng)絡(luò)營(yíng)銷(xiāo)和我們一樣獲得訂單和生意!

一、安裝前準(zhǔn)備:
操作系統(tǒng):CentOS 6.5 64位操作系統(tǒng)
環(huán)境:jdk1.7.0_45以上,本次采用jdk-7u55-linux-x64.tar.gz
master01 10.10.2.57 namenode 節(jié)點(diǎn)
master02 10.10.2.58 namenode 節(jié)點(diǎn)
slave01:10.10.2.173 datanode 節(jié)點(diǎn)
slave02:10.10.2.59 datanode 節(jié)點(diǎn)
slave03: 10.10.2.60 datanode 節(jié)點(diǎn)
注:Hadoop2.0以上采用的是jdk環(huán)境是1.7,Linux自帶的jdk卸載掉,重新安裝
下載地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html
軟件版本:hadoop-2.3.0-cdh6.1.0.tar.gz, zookeeper-3.4.5-cdh6.1.0.tar.gz
下載地址:http://archive.cloudera.com/cdh6/cdh/5/
開(kāi)始安裝:
二、jdk安裝
1、檢查是否自帶jdk
rpm -qa | grep jdk
java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.i686 
2、卸載自帶jdk
yum -y remove java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.i686
3、安裝jdk-7u55-linux-x64.tar.gz
在usr/目錄下創(chuàng)建文件夾java,在java文件夾下運(yùn)行tar –zxvf jdk-7u55-linux-x64.tar.gz
解壓到j(luò)ava目錄下
[root@master01 java]# ls
jdk1.7.0_55
三、配置環(huán)境變量
遠(yuǎn)行vi /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
export JAVA_HOME=/usr/java/jdk1.7.0_55
export JRE_HOME=/usr/java/jdk1.7.0_55/jre
export CLASSPATH=/usr/java/jdk1.7.0_55/lib
export PATH=$JAVA_HOME/bin: $PATH
保存修改,運(yùn)行source /etc/profile 重新加載環(huán)境變量
運(yùn)行java -version
[root@master01 java]# java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Jdk配置成功
四、系統(tǒng)配置
預(yù)先準(zhǔn)備5臺(tái)機(jī)器,并配置IP
關(guān)閉防火墻
chkconfig iptables off(永久性關(guān)閉)
配置主機(jī)名和hosts文件
[root@master01 java]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.2.57 master01
10.10.2.58 master02
10.10.2.173 slave01
10.10.2.59 slave02
10.10.2.60 slave03
按照不同機(jī)器IP配置不同的主機(jī)名
3、SSH無(wú)密碼驗(yàn)證配置
因?yàn)镠adoop運(yùn)行過(guò)程需要遠(yuǎn)程管理Hadoop的守護(hù)進(jìn)程,NameNode節(jié)點(diǎn)需要通過(guò)SSH(Secure Shell)鏈接各個(gè)DataNode節(jié)點(diǎn),停止或啟動(dòng)他們的進(jìn)程,所以SSH必須是沒(méi)有密碼的,所以我們要把NameNode節(jié)點(diǎn)和DataNode節(jié)點(diǎn)配制成無(wú)秘密通信,同理DataNode也需要配置無(wú)密碼鏈接NameNode節(jié)點(diǎn)。
在每一臺(tái)機(jī)器上配置:
vi /etc/ssh/sshd_config打開(kāi)
RSAAuthentication yes # 啟用 RSA 認(rèn)證,PubkeyAuthentication yes # 啟用公鑰私鑰配對(duì)認(rèn)證方式
Master01:運(yùn)行:ssh-keygen –t rsa –P ''  不輸入密碼直接enter
默認(rèn)存放在 /root/.ssh目錄下,
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[root@master01 .ssh]# ls
authorized_keys  id_rsa  id_rsa.pub  known_hosts
slave01執(zhí)行相同的操作,然后將master01 /root/.ssh/目錄下的id_rsa.pub放到 slave01 相同目錄下的authorized_keys這樣slave01就持有了master01的公鑰 然后直接ssh slave01測(cè)試是否可以無(wú)密碼連接到slave01上,然后將slave01 上的id_rsa.pub 追加到master01的authorized_keys中,測(cè)試ssh master01 是否可以直接連上slave01.
[root@master01 ~]# ssh slave01
Last login: Tue Aug 19 14:28:15 2014 from master01
[root@slave01 ~]# 
Master01-master02
Master01-slave01
Master01-slave02
Master01-slave03
Master02-slave01
Master02-slave02
Master02-slave03
執(zhí)行相同的操作。
 
五、安裝Hadoop
建立文件目錄 /usr/local/cloud 創(chuàng)建文件夾data,存放數(shù)據(jù)、日志文件,haooop原文件,zookeeper原文件
[root@slave01 cloud]# ls
data  hadoop  tar  zookeeper
5.1、配置hadoop-env.sh
進(jìn)入到/usr/local/cloud/hadoop/etc/hadoop目錄下
配置vi hadoop-env.sh hadoop運(yùn)行環(huán)境加載
export JAVA_HOME=/usr/java/jdk1.7.0_55
5.2、配置core-site.xml


    hadoop.tmp.dir
    /usr/local/cloud/data/hadoop/tmp



    fs.defaultFS
    hdfs://zzg


 
    ha.zookeeper.quorum
    master01:2181,slave01:2181,slave02:2181

 
(2)hdfs-site.xml配置


    dfs.namenode.name.dir
    /usr/local/cloud/data/hadoop/dfs/nn



    dfs.datanode.data.dir
    /usr/local/cloud/data/hadoop/dfs/dn



    dfs.replication
    3



    dfs.webhdfs.enabled
    true



     dfs.permissions
     false



     dfs.permissions.enabled
     false




    dfs.nameservices
    zzg



    dfs.ha.namenodes.zzg
    nn1,nn2



    dfs.namenode.rpc-address.zzg.nn1
    master01:9000


    dfs.namenode.rpc-address.zzg.nn2
    master02:9000



    dfs.namenode.http-address.zzg.nn1
    master01:50070


    dfs.namenode.http-address.zzg.nn2
    master02:50070



    dfs.namenode.servicerpc-address.zzg.nn1
    master01:53310


    dfs.namenode.servicerpc-address.zzg.nn2
    master02:53310



    dfs.namenode.shared.edits.dir
    qjournal://master01:8485;slave01:8485;slave02:8485/zzg

 

    dfs.journalnode.edits.dir
    /usr/local/cloud/data/hadoop/ha/journal



    dfs.client.failover.proxy.provider.zzg
    org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider



    dfs.ha.automatic-failover.enabled
    true


        ha.zookeeper.quorum
        master01:2181,slave01:2181,slave02:2181



    dfs.ha.fencing.methods
    sshfence



    dfs.ha.fencing.ssh.private-key-files
    /root/.ssh/id_rsa

5.3 配置maped-site.xml

                mapreduce.framework.name
                yarn

5.4配置yarn HA 
配置yarn-en.sh java環(huán)境
# some Java parameters
  export JAVA_HOME=/usr/java/jdk1.7.0_55
5.5配置yarn-site.xml
        
        
                yarn.resourcemanager.connect.retry-interval.ms
                2000
        
        
         
                yarn.resourcemanager.ha.enabled
                true
        
        
        
                yarn.resourcemanager.ha.automatic-failover.enabled
                true
        
        
        
                yarn.resourcemanager.ha.rm-ids
                rm1,rm2
        
        
        
                yarn.resourcemanager.ha.id
                rm1
               If we want to launch more than one RM in single node, we need this configuration
         
        
         
                yarn.resourcemanager.recovery.enabled
                 true
        
        
        
                yarn.resourcemanager.zk-state-store.address
                localhost:2181
        
 
        
                yarn.resourcemanager.store.class
                org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore
        
        
                yarn.resourcemanager.zk-address
                localhost:2181
        
        
                yarn.resourcemanager.cluster-id
                yarn-cluster
        
        
         
                yarn.app.mapreduce.am.scheduler.connection.wait.interval-ms
                5000
        
        
        
                yarn.resourcemanager.address.rm1
                master01:23140
        
        
                yarn.resourcemanager.scheduler.address.rm1
                master01:23130
        
        
                yarn.resourcemanager.webapp.address.rm1
                master01:23188
        
        
                yarn.resourcemanager.resource-tracker.address.rm1
                master01:23125
        
         
                yarn.resourcemanager.admin.address.rm1
                master01:23141
        
        
                yarn.resourcemanager.ha.admin.address.rm1
                master01:23142
        
        
         
                yarn.resourcemanager.address.rm2
                master02:23140
        
        
                yarn.resourcemanager.scheduler.address.rm2
                master02:23130
        
        
                yarn.resourcemanager.webapp.address.rm2
                master02:23188
        
        
                yarn.resourcemanager.resource-tracker.address.rm2
                master02:23125
        
        
                yarn.resourcemanager.admin.address.rm2
                master02:23141
        
        
                yarn.resourcemanager.ha.admin.address.rm2
                master02:23142
        
        
        
                Address where the localizer IPC is.
                yarn.nodemanager.localizer.address
                0.0.0.0:23344
        
        
         
                NM Webapp address.
                yarn.nodemanager.webapp.address
                0.0.0.0:23999
        
        
                yarn.nodemanager.aux-services
                mapreduce_shuffle
        
        
                yarn.nodemanager.aux-services.mapreduce.shuffle.class
                org.apache.hadoop.mapred.ShuffleHandler
        
        
                yarn.nodemanager.local-dirs
                /usr/local/cloud/data/hadoop/yarn/local
        
        
                yarn.nodemanager.log-dirs
                /usr/local/cloud/data/logs/hadoop
        
        
                mapreduce.shuffle.port
                23080
        
        
         
                yarn.client.failover-proxy-provider
                 org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider
         
六、配置zookeeper集群
在zookeeper目錄下建立data目錄 和logs目錄,
配置zoo.cnf
dataDir=/usr/local/cloud/zookeeper/data
dataLogDir=/usr/local/cloud/zookeeper/logs
# the port at which the clients will connect
clientPort=2181
server.1=master01:2888:3888
server.2=master02:2888:3888
server.3=slave01:2888:3888
server.4=slave02:2888:3888
server.5=slave03:2888:3888
在data目錄下創(chuàng)建myid文件,并在對(duì)應(yīng)的機(jī)器上填寫(xiě)數(shù)字,如上配置master01 server01 的myid寫(xiě)入1,
master02 中的data的myid寫(xiě)入2,依次在其他機(jī)子上執(zhí)行相同操作。
在各個(gè)機(jī)器下zookeeper目錄下的bin目錄下執(zhí)行zkServer.sh start命令
再運(yùn)行zkServer.sh status如果出現(xiàn)leader 或fllower 則說(shuō)明集群配置正確。
 
到此各個(gè)配置文件配置完畢
七、啟動(dòng)Hadoop集群嚴(yán)格按照以下順序執(zhí)行(第一次)
(1)各個(gè)節(jié)點(diǎn)啟動(dòng)zookeeper,在zookeeper/bin/zkServer.sh start
(2) 在hadoop/bin/hdfs zkfc –formatZK 進(jìn)行格式化創(chuàng)建命名空間
(3)在配置了journalnode的節(jié)點(diǎn)啟動(dòng),master01,slave01,slave02
   在hadoop/sbin/hadoop-daemon.sh  journalnode
(4)在主namenode節(jié)點(diǎn)執(zhí)行格式化
./bin/hadoop namenode -format zzg
 主機(jī)器上啟動(dòng)namenode
 hadoop/sbin/ hadoop-daemon.sh start namenode
(5)將主namenode節(jié)點(diǎn)格式化的目錄拷貝到從主namenode節(jié)點(diǎn)上
hadoop/bin/hdfs namenode –bootstrapStandby
hadoop/sbin/hadoop-daemon.sh start namenode
(6) 在兩個(gè)namenode節(jié)點(diǎn)都執(zhí)行以下命令
./sbin/hadoop-daemon.sh start zkfc
(7) 在所有datanode節(jié)點(diǎn)都執(zhí)行以下命令啟動(dòng)datanode
./sbin/hadoop-daemon.sh start datanode
(8)在主namenode節(jié)點(diǎn)啟動(dòng)yarn,運(yùn)行yarn-start.sh命令
jps可以看到
namenode節(jié)點(diǎn)
[root@master01 ~]# jps
38972 JournalNode
38758 NameNode
39166 DFSZKFailoverController
37473 QuorumPeerMain
39778 ResourceManager
42620 Jps
datanode節(jié)點(diǎn)
[root@slave01 ~]# jps
33440 DataNode
35277 Jps
32681 QuorumPeerMain
33568 JournalNode
34231 NodeManager

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“hadoop-2.3.0-cdh5.1.0完全分布式集群配置及HA配置的示例分析”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!


網(wǎng)站標(biāo)題:hadoop-2.3.0-cdh5.1.0完全分布式集群配置及HA配置的示例分析
網(wǎng)址分享:http://weahome.cn/article/jsjgjg.html

其他資訊

在線(xiàn)咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部