YongSir

专业程序员伪装者

hadoop集群搭建tip.md

hadoop + yarn + zookeeper: 5个节点搭建Demo

1 规划

  • 统一useradd:hadoop + passwd,目录~/app + ~/data + ~/tools
编号 nameNode dataNode journalnode resoucrcemanager datamanager zookeeper
node1
node2
node3
node4
node5
  • hadoop2.6.9 stable + jdk1.7 + zookeeper 3.4
  • ntpdate时钟同步 + ssh + 脚本

2 安装

  • jdk + 环境变量
  • Zookeeper+ 环境变量

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    zoo.cfg:
    clientPort = 2181;
    service.1=node1:2888:3888
    service.2=node1:2888:3888
    service.3=node1:2888:3888
    service.4=node1:2888:3888
    service.5=node1:2888:3888
    dataDir=/home/hadoop/data/zookeeper/zkdata
    dataLogDir=/home/hadoop/data/zookeeper/zkdatalog
    ----
    zkdata下:
    myid >> 节点编号
    启动测试:
    脚本 + ~/app/zookeeper/bin/zkServir.sh start/status + jps
  • hadoop + 环境变量

    hadoop-env.sh + core-site.xml + hdfs-site.xml
    

    首次顺序: zookeeper >> journalnode >> namebode format >> zkfc format >> 启动namenode + 备用namenode启动并同步 >> journalnode stop
    无误可使用sbin/start-dfs.sh启动

  • YARN配置: mapred-site.xml + yarn-site.xml(resourcemanager配给node1,node2,启动热备,mapReduce-shufflehandler)

3 测试

  • namenode热备测试:查看host:8088 >> active/standby >> 关闭active >> 查看standy自动active
  • recourcemanager测试:查看状态 rmadmin -getServiceStae node1/2 >> active/standby >> 关闭active >> standy自动激活
  • 官方Demo测试