CentOS搭建HA高可用Hadoop 2.7.6 集群(3)

# 其中mini03、mini04、mini06、mini07状态如下
[yun@mini03 bin]$ ./zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper/bin/../conf/zoo.cfg
Mode: follower

# 其中mini05 状态如下
[yun@mini05 bin]$ ./zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper/bin/../conf/zoo.cfg
Mode: leader

PS:4个follower 1个leader

7. Hadoop部署与配置修改

  注意:每台机器的Hadoop以及配置相同

7.1. 部署

[yun@mini01 software]$ pwd
/app/software
[yun@mini01 software]$ ll
total 194152
-rw-r--r-- 1 yun yun 198811365 Jun  8 16:36 CentOS-7.4_hadoop-2.7.6.tar.gz
[yun@mini01 software]$ tar xf CentOS-7.4_hadoop-2.7.6.tar.gz
[yun@mini01 software]$ mv hadoop-2.7.6/ /app/
[yun@mini01 software]$ cd
[yun@mini01 ~]$ ln -s hadoop-2.7.6/ hadoop
[yun@mini01 ~]$ ll
total 4
lrwxrwxrwx  1 yun yun  13 Jun  9 16:21 hadoop -> hadoop-2.7.6/
drwxr-xr-x  9 yun yun  149 Jun  8 16:36 hadoop-2.7.6
lrwxrwxrwx  1 yun yun  12 May 26 11:18 jdk -> jdk1.8.0_112
drwxr-xr-x  8 yun yun  255 Sep 23  2016 jdk1.8.0_112

7.2. 环境变量

[root@mini01 profile.d]# pwd
/etc/profile.d
[root@mini01 profile.d]# vim hadoop.sh
export HADOOP_HOME="/app/hadoop"
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
 
[root@mini01 profile.d]# source /etc/profile  # 生效

7.3. core-site.xml

[yun@mini01 hadoop]$ pwd
/app/hadoop/etc/hadoop
[yun@mini01 hadoop]$ vim core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!--
……………………
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
  <!-- 指定hdfs的nameservice为bi -->
  <property>
    <name>fs.defaultFS</name>
    <value>hdfs://bi/</value>
  </property>

<!-- 指定hadoop临时目录 -->
  <property>
    <name>hadoop.tmp.dir</name>
    <value>/app/hadoop/tmp</value>
  </property>

<!-- 指定zookeeper地址 -->
  <property>
    <name>ha.zookeeper.quorum</name>
    <value>mini03:2181,mini04:2181,mini05:2181,mini06:2181,mini07:2181</value>
  </property>

</configuration>

7.4. hdfs-site.xml

[yun@mini01 hadoop]$ pwd
/app/hadoop/etc/hadoop
[yun@mini01 hadoop]$ vim hdfs-site.xml 
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<!--
  ……………………
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
  <!--指定hdfs的nameservice为bi,需要和core-site.xml中的保持一致 -->
  <property>
    <name>dfs.nameservices</name>
    <value>bi</value>
  </property>

<!-- bi下面有两个NameNode,分别是nn1,nn2 -->
  <property>
    <name>dfs.ha.namenodes.bi</name>
    <value>nn1,nn2</value>
  </property>

<!-- nn1的RPC通信地址 -->
  <property>
    <name>dfs.namenode.rpc-address.bi.nn1</name>
    <value>mini01:9000</value>
  </property>
  <!-- nn1的http通信地址 -->
  <property>
    <name>dfs.namenode.http-address.bi.nn1</name>
    <value>mini01:50070</value>
  </property>

<!-- nn2的RPC通信地址 -->
  <property>
    <name>dfs.namenode.rpc-address.bi.nn2</name>
    <value>mini02:9000</value>
  </property>
  <!-- nn2的http通信地址 -->
  <property>
    <name>dfs.namenode.http-address.bi.nn2</name>
    <value>mini02:50070</value>
  </property>

<!-- 指定NameNode的edits元数据在JournalNode上的存放位置 -->
  <property>
    <name>dfs.namenode.shared.edits.dir</name>
    <value>qjournal://mini05:8485;mini06:8485;mini07:8485/bi</value>
  </property>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/028c0c86d8f9b5be9a5c02d3abb572f9.html