Apache Hadoop HDFS高可用部署实战案例

            Apache Hadoop HDFS高可用部署实战案例

                                        作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.Hadoop HA准备环境

1>.实验环境说明

  本篇博客采用6台Linux发行版本为"CentOS Linux release 7.6.1810 (Core)"操作系统部署Hadoop HA完全分布式集群。

  本篇博客介绍了如何安装和配置Hadoop集群,范围从几个节点到具有数千个节点的超大型集群。要使用Hadoop,你可能需要将其安装在单台机器上,可参考我之前的笔记,链接如下:
    https://www.cnblogs.com/yinzhengjie2020/p/12422758.html

  各节点Hadoop角色分配如下,当然你也可以将下面的角色自定义进行合并到一台主机,虽然博主不建议你这样干,但是如果你的物理机实在内存不足建议至少保留2台虚拟机,将下面的所有的角色分配到2个节点,但是对你的体验可能较差。
    hadoop101.yinzhengjie.org.cn:
      部署NameNode,zookeeper角色

    hadoop102.yinzhengjie.org.cn:
      部署DataNode,NodeManager角色

    hadoop103.yinzhengjie.org.cn:
      部署DataNode,NodeManager,zookeeper角色

    hadoop104.yinzhengjie.org.cn:
      部署DataNode,NodeManager,zookeeper角色

    hadoop105.yinzhengjie.org.cn:  
      暂不使用

    hadoop106.yinzhengjie.org.cn:
      部署ResourceManager,NameNode角色

2>.配置namenode节点和集群各节点免密登录

[root@hadoop101.yinzhengjie.org.cn ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa              #快速生成私钥和公钥
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:+xTXq08c66RwzI70WB+HXCmPY1ml2f/g4UfAEp8We/g root@hadoop101.yinzhengjie.org.cn
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|            . .  |
|             + =.|
|            ..O++|
|        S . .+=*o|
|         . = o**E|
|        . + ==%oo|
|         + O.X.=o|
|          + =.*..|
+----[SHA256]-----+
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ll ~/.ssh/
total 8
-rw------- 1 root root 1679 Mar 11 18:00 id_rsa            #私钥
-rw-r--r-- 1 root root  415 Mar 11 18:00 id_rsa.pub          #公钥
[root@hadoop101.yinzhengjie.org.cn ~]#
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop101.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop101.yinzhengjie.org.cn (172.200.4.101)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop101.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop101.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh root@hadoop101.yinzhengjie.org.cn
Last login: Wed Mar 11 17:58:12 2020 from 172.200.0.1
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
root     pts/1        2020-03-11 18:04 (172.200.4.101)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop101.yinzhengjie.org.cn closed.
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop101.yinzhengjie.org.cn
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop102.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop102.yinzhengjie.org.cn (172.200.4.102)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop102.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop102.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who 
root     pts/0        2020-03-11 17:58 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh root@hadoop102.yinzhengjie.org.cn
Last login: Wed Mar 11 13:01:52 2020 from 172.200.0.1
[root@hadoop102.yinzhengjie.org.cn ~]# 
[root@hadoop102.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 18:06 (172.200.4.101)
[root@hadoop102.yinzhengjie.org.cn ~]# 
[root@hadoop102.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop102.yinzhengjie.org.cn closed.
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop102.yinzhengjie.org.cn
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop103.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop103.yinzhengjie.org.cn (172.200.4.103)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop103.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop103.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh root@hadoop103.yinzhengjie.org.cn
Last login: Tue Mar 10 06:37:08 2020 from 172.200.0.1
[root@hadoop103.yinzhengjie.org.cn ~]# 
[root@hadoop103.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 18:10 (172.200.4.101)
[root@hadoop103.yinzhengjie.org.cn ~]# 
[root@hadoop103.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop103.yinzhengjie.org.cn closed.
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop103.yinzhengjie.org.cn
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop104.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop104.yinzhengjie.org.cn (172.200.4.104)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop104.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop104.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh root@hadoop104.yinzhengjie.org.cn
Last login: Tue Mar 10 06:37:30 2020 from 172.200.0.1
[root@hadoop104.yinzhengjie.org.cn ~]# 
[root@hadoop104.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 18:11 (172.200.4.101)
[root@hadoop104.yinzhengjie.org.cn ~]# 
[root@hadoop104.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop104.yinzhengjie.org.cn closed.
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop104.yinzhengjie.org.cn
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop105.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop105.yinzhengjie.org.cn (172.200.4.105)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop105.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop105.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh root@hadoop105.yinzhengjie.org.cn
Last login: Tue Mar 10 06:37:53 2020 from 172.200.0.1
[root@hadoop105.yinzhengjie.org.cn ~]# 
[root@hadoop105.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 18:12 (172.200.4.101)
[root@hadoop105.yinzhengjie.org.cn ~]# 
[root@hadoop105.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop105.yinzhengjie.org.cn closed.
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop105.yinzhengjie.org.cn
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop106.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop106.yinzhengjie.org.cn (172.200.4.106)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop106.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop106.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
root     pts/1        2020-03-11 20:13 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh root@hadoop106.yinzhengjie.org.cn
Last login: Wed Mar 11 21:13:39 2020 from 172.200.0.1
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 21:13 (172.200.0.1)
root     pts/1        2020-03-11 21:14 (172.200.4.101)
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop106.yinzhengjie.org.cn closed.
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-11 17:58 (172.200.0.1)
root     pts/1        2020-03-11 20:13 (172.200.0.1)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop106.yinzhengjie.org.cn
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:8KEEDjqqHLpGPK9HOz/j88WHLZDXXGLYKqTApi8HN7Q root@hadoop106.yinzhengjie.org.cn
The key's randomart image is:
+---[RSA 2048]----+
|  . .            |
| ..o .    o      |
|o  =. o... + .   |
|..+ o.o+..= o    |
|o+ E ..+So o     |
|++=..   = o      |
|+o+o.    = o     |
| oo= +  . o      |
|o.o +o=.         |
+----[SHA256]-----+
[root@hadoop106.yinzhengjie.org.cn ~]#
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop101.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop101.yinzhengjie.org.cn (172.200.4.101)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop101.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop101.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# who
root     pts/0        2020-05-12 20:16 (172.200.0.1)
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh root@hadoop101.yinzhengjie.org.cn
Last login: Tue May 12 20:05:30 2020 from 172.200.4.101
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# who
root     pts/0        2020-05-12 07:03 (172.200.0.1)
root     pts/1        2020-05-12 05:39 (172.200.0.1)
root     pts/2        2020-05-12 20:16 (172.200.4.106)
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop101.yinzhengjie.org.cn closed.
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# who
root     pts/0        2020-05-12 20:16 (172.200.0.1)
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop101.yinzhengjie.org.cn
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop102.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop102.yinzhengjie.org.cn (172.200.4.102)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop102.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop102.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 06:49 (172.200.0.1)
root     pts/1        2020-03-12 07:31 (172.200.0.1)
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh root@hadoop102.yinzhengjie.org.cn
Last login: Thu Mar 12 07:35:49 2020 from 172.200.4.101
[root@hadoop102.yinzhengjie.org.cn ~]# 
[root@hadoop102.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 07:41 (172.200.4.106)
[root@hadoop102.yinzhengjie.org.cn ~]# 
[root@hadoop102.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop102.yinzhengjie.org.cn closed.
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 06:49 (172.200.0.1)
root     pts/1        2020-03-12 07:31 (172.200.0.1)
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop102.yinzhengjie.org.cn
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop103.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop103.yinzhengjie.org.cn (172.200.4.103)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop103.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop103.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 06:49 (172.200.0.1)
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh root@hadoop103.yinzhengjie.org.cn
Last login: Thu Mar 12 07:20:02 2020 from 172.200.0.1
[root@hadoop103.yinzhengjie.org.cn ~]# 
[root@hadoop103.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 07:20 (172.200.0.1)
root     pts/1        2020-03-12 07:28 (172.200.4.106)
[root@hadoop103.yinzhengjie.org.cn ~]# 
[root@hadoop103.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop103.yinzhengjie.org.cn closed.
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop103.yinzhengjie.org.cn
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop104.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop104.yinzhengjie.org.cn (172.200.4.104)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop104.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop104.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 06:49 (172.200.0.1)
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh root@hadoop104.yinzhengjie.org.cn
Last login: Thu Mar 12 06:55:07 2020 from 172.200.4.101
[root@hadoop104.yinzhengjie.org.cn ~]# 
[root@hadoop104.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 07:29 (172.200.4.106)
[root@hadoop104.yinzhengjie.org.cn ~]# 
[root@hadoop104.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop104.yinzhengjie.org.cn closed.
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop104.yinzhengjie.org.cn
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop105.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop105.yinzhengjie.org.cn (172.200.4.105)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:2a:93:c0:d4:6e:7e:13:16:61:f1:93:a7:38:01.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop105.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop105.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 06:49 (172.200.0.1)
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh root@hadoop105.yinzhengjie.org.cn
Last login: Thu Mar 12 06:55:07 2020 from 172.200.4.101
[root@hadoop105.yinzhengjie.org.cn ~]# 
[root@hadoop105.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 07:29 (172.200.4.106)
[root@hadoop105.yinzhengjie.org.cn ~]# 
[root@hadoop105.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop105.yinzhengjie.org.cn closed.
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop105.yinzhengjie.org.cn
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop106.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'hadoop106.yinzhengjie.org.cn (172.200.4.106)' can't be established.
ECDSA key fingerprint is SHA256:y6iS5ipSyWSGRmgcjivbWhd78pKfrcuQHeBPd5H9/U8.
ECDSA key fingerprint is MD5:da:0f:3a:91:c0:d7:6e:72:13:16:61:f1:93:a1:38:31.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@hadoop106.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@hadoop106.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 06:49 (172.200.0.1)
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh root@hadoop106.yinzhengjie.org.cn
Last login: Thu Mar 12 06:55:07 2020 from 172.200.4.101
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# who
root     pts/0        2020-03-12 07:29 (172.200.4.106)
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# exit 
logout
Connection to hadoop106.yinzhengjie.org.cn closed.
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# ssh-copy-id root@hadoop106.yinzhengjie.org.cn

3>.安装ansible并配置hadoop主机清单

[root@hadoop101.yinzhengjie.org.cn ~]# yum list ansible
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Determining fastest mirrors
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirrors.aliyun.com
Available Packages
ansible.noarch                                                                                                                      2.4.2.0-2.el7                                                                                                                       extras
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# yum list ansible
[root@hadoop101.yinzhengjie.org.cn ~]# yum -y install ansible
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirrors.aliyun.com
base                                                                                                                                                                                                                                                   | 3.6 kB  00:00:00     
extras                                                                                                                                                                                                                                                 | 2.9 kB  00:00:00     
updates                                                                                                                                                                                                                                                | 2.9 kB  00:00:00     
(1/2): extras/7/x86_64/primary_db                                                                                                                                                                                                                      | 164 kB  00:00:00     
(2/2): updates/7/x86_64/primary_db                                                                                                                                                                                                                     | 6.7 MB  00:00:01     
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:2.4.2.0-2.el7 will be installed
--> Processing Dependency: sshpass for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python2-jmespath for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-six for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-setuptools for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-passlib for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-paramiko for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-jinja2 for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-httplib2 for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: python-cryptography for package: ansible-2.4.2.0-2.el7.noarch
--> Processing Dependency: PyYAML for package: ansible-2.4.2.0-2.el7.noarch
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-11.el7 will be installed
--> Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-11.el7.x86_64
---> Package python-httplib2.noarch 0:0.9.2-1.el7 will be installed
---> Package python-jinja2.noarch 0:2.7.2-4.el7 will be installed
--> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-2.7.2-4.el7.noarch
--> Processing Dependency: python-markupsafe for package: python-jinja2-2.7.2-4.el7.noarch
---> Package python-paramiko.noarch 0:2.1.1-9.el7 will be installed
--> Processing Dependency: python2-pyasn1 for package: python-paramiko-2.1.1-9.el7.noarch
---> Package python-passlib.noarch 0:1.6.5-2.el7 will be installed
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
---> Package python-six.noarch 0:1.9.0-2.el7 will be installed
---> Package python2-cryptography.x86_64 0:1.7.2-2.el7 will be installed
--> Processing Dependency: python-idna >= 2.0 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-cffi >= 1.4.1 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-ipaddress for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-enum34 for package: python2-cryptography-1.7.2-2.el7.x86_64
---> Package python2-jmespath.noarch 0:0.9.0-3.el7 will be installed
---> Package sshpass.x86_64 0:1.06-2.el7 will be installed
--> Running transaction check
---> Package libyaml.x86_64 0:0.1.4-11.el7_0 will be installed
---> Package python-babel.noarch 0:0.9.6-8.el7 will be installed
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
---> Package python-cffi.x86_64 0:1.6.0-5.el7 will be installed
--> Processing Dependency: python-pycparser for package: python-cffi-1.6.0-5.el7.x86_64
---> Package python-enum34.noarch 0:1.0.4-1.el7 will be installed
---> Package python-idna.noarch 0:2.4-1.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
---> Package python-markupsafe.x86_64 0:0.11-10.el7 will be installed
---> Package python2-pyasn1.noarch 0:0.1.9-7.el7 will be installed
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-pycparser.noarch 0:2.14-1.el7 will be installed
--> Processing Dependency: python-ply for package: python-pycparser-2.14-1.el7.noarch
--> Running transaction check
---> Package python-ply.noarch 0:3.4-11.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================================================================================
 Package                                                                              Arch                                                    Version                                                           Repository                                               Size
==============================================================================================================================================================================================================================================================================
Installing:
 ansible                                                                              noarch                                                  2.4.2.0-2.el7                                                     extras                                                  7.6 M
Installing for dependencies:
 PyYAML                                                                               x86_64                                                  3.10-11.el7                                                       base                                                    153 k
 libyaml                                                                              x86_64                                                  0.1.4-11.el7_0                                                    base                                                     55 k
 python-babel                                                                         noarch                                                  0.9.6-8.el7                                                       base                                                    1.4 M
 python-backports                                                                     x86_64                                                  1.0-8.el7                                                         base                                                    5.8 k
 python-backports-ssl_match_hostname                                                  noarch                                                  3.5.0.1-1.el7                                                     base                                                     13 k
 python-cffi                                                                          x86_64                                                  1.6.0-5.el7                                                       base                                                    218 k
 python-enum34                                                                        noarch                                                  1.0.4-1.el7                                                       base                                                     52 k
 python-httplib2                                                                      noarch                                                  0.9.2-1.el7                                                       extras                                                  115 k
 python-idna                                                                          noarch                                                  2.4-1.el7                                                         base                                                     94 k
 python-ipaddress                                                                     noarch                                                  1.0.16-2.el7                                                      base                                                     34 k
 python-jinja2                                                                        noarch                                                  2.7.2-4.el7                                                       base                                                    519 k
 python-markupsafe                                                                    x86_64                                                  0.11-10.el7                                                       base                                                     25 k
 python-paramiko                                                                      noarch                                                  2.1.1-9.el7                                                       base                                                    269 k
 python-passlib                                                                       noarch                                                  1.6.5-2.el7                                                       extras                                                  488 k
 python-ply                                                                           noarch                                                  3.4-11.el7                                                        base                                                    123 k
 python-pycparser                                                                     noarch                                                  2.14-1.el7                                                        base                                                    104 k
 python-setuptools                                                                    noarch                                                  0.9.8-7.el7                                                       base                                                    397 k
 python-six                                                                           noarch                                                  1.9.0-2.el7                                                       base                                                     29 k
 python2-cryptography                                                                 x86_64                                                  1.7.2-2.el7                                                       base                                                    502 k
 python2-jmespath                                                                     noarch                                                  0.9.0-3.el7                                                       extras                                                   39 k
 python2-pyasn1                                                                       noarch                                                  0.1.9-7.el7                                                       base                                                    100 k
 sshpass                                                                              x86_64                                                  1.06-2.el7                                                        extras                                                   21 k

Transaction Summary
==============================================================================================================================================================================================================================================================================
Install  1 Package (+22 Dependent packages)

Total download size: 12 M
Installed size: 60 M
Downloading packages:
(1/23): PyYAML-3.10-11.el7.x86_64.rpm                                                                                                                                                                                                                  | 153 kB  00:00:00     
(2/23): libyaml-0.1.4-11.el7_0.x86_64.rpm                                                                                                                                                                                                              |  55 kB  00:00:00     
(3/23): python-backports-1.0-8.el7.x86_64.rpm                                                                                                                                                                                                          | 5.8 kB  00:00:00     
(4/23): python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm                                                                                                                                                                                   |  13 kB  00:00:00     
(5/23): python-cffi-1.6.0-5.el7.x86_64.rpm                                                                                                                                                                                                             | 218 kB  00:00:00     
(6/23): python-enum34-1.0.4-1.el7.noarch.rpm                                                                                                                                                                                                           |  52 kB  00:00:00     
(7/23): python-idna-2.4-1.el7.noarch.rpm                                                                                                                                                                                                               |  94 kB  00:00:00     
(8/23): python-ipaddress-1.0.16-2.el7.noarch.rpm                                                                                                                                                                                                       |  34 kB  00:00:00     
(9/23): python-babel-0.9.6-8.el7.noarch.rpm                                                                                                                                                                                                            | 1.4 MB  00:00:00     
(10/23): python-markupsafe-0.11-10.el7.x86_64.rpm                                                                                                                                                                                                      |  25 kB  00:00:00     
(11/23): python-httplib2-0.9.2-1.el7.noarch.rpm                                                                                                                                                                                                        | 115 kB  00:00:00     
(12/23): python-jinja2-2.7.2-4.el7.noarch.rpm                                                                                                                                                                                                          | 519 kB  00:00:00     
(13/23): python-ply-3.4-11.el7.noarch.rpm                                                                                                                                                                                                              | 123 kB  00:00:00     
(14/23): python-paramiko-2.1.1-9.el7.noarch.rpm                                                                                                                                                                                                        | 269 kB  00:00:00     
(15/23): python-pycparser-2.14-1.el7.noarch.rpm                                                                                                                                                                                                        | 104 kB  00:00:00     
(16/23): python-six-1.9.0-2.el7.noarch.rpm                                                                                                                                                                                                             |  29 kB  00:00:00     
(17/23): python-passlib-1.6.5-2.el7.noarch.rpm                                                                                                                                                                                                         | 488 kB  00:00:00     
(18/23): python-setuptools-0.9.8-7.el7.noarch.rpm                                                                                                                                                                                                      | 397 kB  00:00:00     
(19/23): python2-jmespath-0.9.0-3.el7.noarch.rpm                                                                                                                                                                                                       |  39 kB  00:00:00     
(20/23): sshpass-1.06-2.el7.x86_64.rpm                                                                                                                                                                                                                 |  21 kB  00:00:00     
(21/23): python2-pyasn1-0.1.9-7.el7.noarch.rpm                                                                                                                                                                                                         | 100 kB  00:00:00     
(22/23): python2-cryptography-1.7.2-2.el7.x86_64.rpm                                                                                                                                                                                                   | 502 kB  00:00:00     
(23/23): ansible-2.4.2.0-2.el7.noarch.rpm                                                                                                                                                                                                              | 7.6 MB  00:00:01     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                         7.8 MB/s |  12 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python2-pyasn1-0.1.9-7.el7.noarch                                                                                                                                                                                                                         1/23 
  Installing : python-ipaddress-1.0.16-2.el7.noarch                                                                                                                                                                                                                      2/23 
  Installing : python-six-1.9.0-2.el7.noarch                                                                                                                                                                                                                             3/23 
  Installing : python-httplib2-0.9.2-1.el7.noarch                                                                                                                                                                                                                        4/23 
  Installing : sshpass-1.06-2.el7.x86_64                                                                                                                                                                                                                                 5/23 
  Installing : libyaml-0.1.4-11.el7_0.x86_64                                                                                                                                                                                                                             6/23 
  Installing : PyYAML-3.10-11.el7.x86_64                                                                                                                                                                                                                                 7/23 
  Installing : python-backports-1.0-8.el7.x86_64                                                                                                                                                                                                                         8/23 
  Installing : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch                                                                                                                                                                                                  9/23 
  Installing : python-setuptools-0.9.8-7.el7.noarch                                                                                                                                                                                                                     10/23 
  Installing : python-babel-0.9.6-8.el7.noarch                                                                                                                                                                                                                          11/23 
  Installing : python-passlib-1.6.5-2.el7.noarch                                                                                                                                                                                                                        12/23 
  Installing : python-ply-3.4-11.el7.noarch                                                                                                                                                                                                                             13/23 
  Installing : python-pycparser-2.14-1.el7.noarch                                                                                                                                                                                                                       14/23 
  Installing : python-cffi-1.6.0-5.el7.x86_64                                                                                                                                                                                                                           15/23 
  Installing : python-markupsafe-0.11-10.el7.x86_64                                                                                                                                                                                                                     16/23 
  Installing : python-jinja2-2.7.2-4.el7.noarch                                                                                                                                                                                                                         17/23 
  Installing : python-idna-2.4-1.el7.noarch                                                                                                                                                                                                                             18/23 
  Installing : python-enum34-1.0.4-1.el7.noarch                                                                                                                                                                                                                         19/23 
  Installing : python2-cryptography-1.7.2-2.el7.x86_64                                                                                                                                                                                                                  20/23 
  Installing : python-paramiko-2.1.1-9.el7.noarch                                                                                                                                                                                                                       21/23 
  Installing : python2-jmespath-0.9.0-3.el7.noarch                                                                                                                                                                                                                      22/23 
  Installing : ansible-2.4.2.0-2.el7.noarch                                                                                                                                                                                                                             23/23 
  Verifying  : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch                                                                                                                                                                                                  1/23 
  Verifying  : python2-jmespath-0.9.0-3.el7.noarch                                                                                                                                                                                                                       2/23 
  Verifying  : python-enum34-1.0.4-1.el7.noarch                                                                                                                                                                                                                          3/23 
  Verifying  : python-setuptools-0.9.8-7.el7.noarch                                                                                                                                                                                                                      4/23 
  Verifying  : python-jinja2-2.7.2-4.el7.noarch                                                                                                                                                                                                                          5/23 
  Verifying  : python-six-1.9.0-2.el7.noarch                                                                                                                                                                                                                             6/23 
  Verifying  : python-idna-2.4-1.el7.noarch                                                                                                                                                                                                                              7/23 
  Verifying  : python-markupsafe-0.11-10.el7.x86_64                                                                                                                                                                                                                      8/23 
  Verifying  : python-ply-3.4-11.el7.noarch                                                                                                                                                                                                                              9/23 
  Verifying  : python-passlib-1.6.5-2.el7.noarch                                                                                                                                                                                                                        10/23 
  Verifying  : python-paramiko-2.1.1-9.el7.noarch                                                                                                                                                                                                                       11/23 
  Verifying  : python-babel-0.9.6-8.el7.noarch                                                                                                                                                                                                                          12/23 
  Verifying  : python-backports-1.0-8.el7.x86_64                                                                                                                                                                                                                        13/23 
  Verifying  : python-cffi-1.6.0-5.el7.x86_64                                                                                                                                                                                                                           14/23 
  Verifying  : python-pycparser-2.14-1.el7.noarch                                                                                                                                                                                                                       15/23 
  Verifying  : libyaml-0.1.4-11.el7_0.x86_64                                                                                                                                                                                                                            16/23 
  Verifying  : ansible-2.4.2.0-2.el7.noarch                                                                                                                                                                                                                             17/23 
  Verifying  : python-ipaddress-1.0.16-2.el7.noarch                                                                                                                                                                                                                     18/23 
  Verifying  : sshpass-1.06-2.el7.x86_64                                                                                                                                                                                                                                19/23 
  Verifying  : python-httplib2-0.9.2-1.el7.noarch                                                                                                                                                                                                                       20/23 
  Verifying  : python2-pyasn1-0.1.9-7.el7.noarch                                                                                                                                                                                                                        21/23 
  Verifying  : PyYAML-3.10-11.el7.x86_64                                                                                                                                                                                                                                22/23 
  Verifying  : python2-cryptography-1.7.2-2.el7.x86_64                                                                                                                                                                                                                  23/23 

Installed:
  ansible.noarch 0:2.4.2.0-2.el7                                                                                                                                                                                                                                              

Dependency Installed:
  PyYAML.x86_64 0:3.10-11.el7                 libyaml.x86_64 0:0.1.4-11.el7_0         python-babel.noarch 0:0.9.6-8.el7     python-backports.x86_64 0:1.0-8.el7      python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7   python-cffi.x86_64 0:1.6.0-5.el7        
  python-enum34.noarch 0:1.0.4-1.el7          python-httplib2.noarch 0:0.9.2-1.el7    python-idna.noarch 0:2.4-1.el7        python-ipaddress.noarch 0:1.0.16-2.el7   python-jinja2.noarch 0:2.7.2-4.el7                           python-markupsafe.x86_64 0:0.11-10.el7  
  python-paramiko.noarch 0:2.1.1-9.el7        python-passlib.noarch 0:1.6.5-2.el7     python-ply.noarch 0:3.4-11.el7        python-pycparser.noarch 0:2.14-1.el7     python-setuptools.noarch 0:0.9.8-7.el7                       python-six.noarch 0:1.9.0-2.el7         
  python2-cryptography.x86_64 0:1.7.2-2.el7   python2-jmespath.noarch 0:0.9.0-3.el7   python2-pyasn1.noarch 0:0.1.9-7.el7   sshpass.x86_64 0:1.06-2.el7             

Complete!
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# yum -y install ansible
[root@hadoop101.yinzhengjie.org.cn ~]# tail -25 /etc/ansible/hosts 
#Add by yinzhengjie for hadoop hosts
#Namenode
[nn]
hadoop101.yinzhengjie.org.cn
hadoop106.yinzhengjie.org.cn

#DataNode
[dn]
hadoop[102:104].yinzhengjie.org.cn

#Journalnode
[jn]
hadoop[102:104].yinzhengjie.org.cn

#NodeManager
[nm]
hadoop[102:104].yinzhengjie.org.cn

#ResourceManager
[rm]
hadoop106.yinzhengjie.org.cn

#Add by yinzhengjie for zookeeper
[zk]
hadoop[101:103].yinzhengjie.org.cn
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible nn -m ping
hadoop101.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
hadoop106.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible nn -m ping
[root@hadoop101.yinzhengjie.org.cn ~]# ansible dn -m ping
hadoop102.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
hadoop103.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
hadoop104.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible dn -m ping
[root@hadoop101.yinzhengjie.org.cn ~]# ansible jn -m ping
hadoop104.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
hadoop103.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
hadoop102.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible jn -m ping
[root@hadoop101.yinzhengjie.org.cn ~]# ansible nm -m ping
hadoop102.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
hadoop104.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
hadoop103.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible nm -m ping
[root@hadoop101.yinzhengjie.org.cn ~]# ansible rm -m ping
hadoop106.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible rm -m ping
[root@hadoop101.yinzhengjie.org.cn ~]# ansible zk -m ping
hadoop102.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
hadoop103.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
hadoop101.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible zk -m ping
  博主推荐阅读:
    https://www.cnblogs.com/yinzhengjie/p/10447587.html

4>.使用ansible工具将"/etc/hosts"文件拷贝到其它节点

[root@hadoop101.yinzhengjie.org.cn ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Hadoop cluster
172.200.4.101 hadoop101.yinzhengjie.org.cn
172.200.4.102 hadoop102.yinzhengjie.org.cn
172.200.4.103 hadoop103.yinzhengjie.org.cn
172.200.4.104 hadoop104.yinzhengjie.org.cn
172.200.4.105 hadoop105.yinzhengjie.org.cn
172.200.4.106 hadoop106.yinzhengjie.org.cn
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cat /etc/hosts
[root@hadoop101.yinzhengjie.org.cn ~]# ansible all -m copy -a 'src=/etc/hosts dest=/etc/hosts'
hadoop101.yinzhengjie.org.cn | SUCCESS => {
    "changed": false, 
    "checksum": "7aa42f0af4417ce6c188ed4cad34287dfa3570ea", 
    "gid": 0, 
    "group": "root", 
    "mode": "0644", 
    "owner": "root", 
    "path": "/etc/hosts", 
    "size": 433, 
    "state": "file", 
    "uid": 0
}
hadoop103.yinzhengjie.org.cn | SUCCESS => {
    "changed": true, 
    "checksum": "7aa42f0af4417ce6c188ed4cad34287dfa3570ea", 
    "dest": "/etc/hosts", 
    "gid": 0, 
    "group": "root", 
    "md5sum": "769e0a0d41e5be699399b271cea8a377", 
    "mode": "0644", 
    "owner": "root", 
    "size": 433, 
    "src": "/root/.ansible/tmp/ansible-tmp-1583932891.99-144884840221439/source", 
    "state": "file", 
    "uid": 0
}
hadoop102.yinzhengjie.org.cn | SUCCESS => {
    "changed": true, 
    "checksum": "7aa42f0af4417ce6c188ed4cad34287dfa3570ea", 
    "dest": "/etc/hosts", 
    "gid": 0, 
    "group": "root", 
    "md5sum": "769e0a0d41e5be699399b271cea8a377", 
    "mode": "0644", 
    "owner": "root", 
    "size": 433, 
    "src": "/root/.ansible/tmp/ansible-tmp-1583932891.96-167534829416060/source", 
    "state": "file", 
    "uid": 0
}
hadoop105.yinzhengjie.org.cn | SUCCESS => {
    "changed": true, 
    "checksum": "7aa42f0af4417ce6c188ed4cad34287dfa3570ea", 
    "dest": "/etc/hosts", 
    "gid": 0, 
    "group": "root", 
    "md5sum": "769e0a0d41e5be699399b271cea8a377", 
    "mode": "0644", 
    "owner": "root", 
    "size": 433, 
    "src": "/root/.ansible/tmp/ansible-tmp-1583932892.02-30034905247840/source", 
    "state": "file", 
    "uid": 0
}
hadoop104.yinzhengjie.org.cn | SUCCESS => {
    "changed": true, 
    "checksum": "7aa42f0af4417ce6c188ed4cad34287dfa3570ea", 
    "dest": "/etc/hosts", 
    "gid": 0, 
    "group": "root", 
    "md5sum": "769e0a0d41e5be699399b271cea8a377", 
    "mode": "0644", 
    "owner": "root", 
    "size": 433, 
    "src": "/root/.ansible/tmp/ansible-tmp-1583932892.04-75312091987102/source", 
    "state": "file", 
    "uid": 0
}
hadoop106.yinzhengjie.org.cn | SUCCESS => {
    "changed": true, 
    "checksum": "7aa42f0af4417ce6c188ed4cad34287dfa3570ea", 
    "dest": "/etc/hosts", 
    "gid": 0, 
    "group": "root", 
    "md5sum": "769e0a0d41e5be699399b271cea8a377", 
    "mode": "0644", 
    "owner": "root", 
    "size": 433, 
    "src": "/root/.ansible/tmp/ansible-tmp-1583932894.24-77039419077594/source", 
    "state": "file", 
    "uid": 0
}
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible all -m copy -a 'src=/etc/hosts dest=/etc/hosts'
[root@hadoop101.yinzhengjie.org.cn ~]# ansible all -m shell -a 'cat /etc/hosts'
hadoop102.yinzhengjie.org.cn | SUCCESS | rc=0 >>
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Hadoop cluster
172.200.4.101 hadoop101.yinzhengjie.org.cn
172.200.4.102 hadoop102.yinzhengjie.org.cn
172.200.4.103 hadoop103.yinzhengjie.org.cn
172.200.4.104 hadoop104.yinzhengjie.org.cn
172.200.4.105 hadoop105.yinzhengjie.org.cn
172.200.4.106 hadoop106.yinzhengjie.org.cn

hadoop105.yinzhengjie.org.cn | SUCCESS | rc=0 >>
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Hadoop cluster
172.200.4.101 hadoop101.yinzhengjie.org.cn
172.200.4.102 hadoop102.yinzhengjie.org.cn
172.200.4.103 hadoop103.yinzhengjie.org.cn
172.200.4.104 hadoop104.yinzhengjie.org.cn
172.200.4.105 hadoop105.yinzhengjie.org.cn
172.200.4.106 hadoop106.yinzhengjie.org.cn

hadoop103.yinzhengjie.org.cn | SUCCESS | rc=0 >>
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Hadoop cluster
172.200.4.101 hadoop101.yinzhengjie.org.cn
172.200.4.102 hadoop102.yinzhengjie.org.cn
172.200.4.103 hadoop103.yinzhengjie.org.cn
172.200.4.104 hadoop104.yinzhengjie.org.cn
172.200.4.105 hadoop105.yinzhengjie.org.cn
172.200.4.106 hadoop106.yinzhengjie.org.cn

hadoop104.yinzhengjie.org.cn | SUCCESS | rc=0 >>
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Hadoop cluster
172.200.4.101 hadoop101.yinzhengjie.org.cn
172.200.4.102 hadoop102.yinzhengjie.org.cn
172.200.4.103 hadoop103.yinzhengjie.org.cn
172.200.4.104 hadoop104.yinzhengjie.org.cn
172.200.4.105 hadoop105.yinzhengjie.org.cn
172.200.4.106 hadoop106.yinzhengjie.org.cn

hadoop101.yinzhengjie.org.cn | SUCCESS | rc=0 >>
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Hadoop cluster
172.200.4.101 hadoop101.yinzhengjie.org.cn
172.200.4.102 hadoop102.yinzhengjie.org.cn
172.200.4.103 hadoop103.yinzhengjie.org.cn
172.200.4.104 hadoop104.yinzhengjie.org.cn
172.200.4.105 hadoop105.yinzhengjie.org.cn
172.200.4.106 hadoop106.yinzhengjie.org.cn

hadoop106.yinzhengjie.org.cn | SUCCESS | rc=0 >>
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Hadoop cluster
172.200.4.101 hadoop101.yinzhengjie.org.cn
172.200.4.102 hadoop102.yinzhengjie.org.cn
172.200.4.103 hadoop103.yinzhengjie.org.cn
172.200.4.104 hadoop104.yinzhengjie.org.cn
172.200.4.105 hadoop105.yinzhengjie.org.cn
172.200.4.106 hadoop106.yinzhengjie.org.cn

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible all -m shell -a 'cat /etc/hosts'

5>.配置集群时间同步

  温馨提示:
    身为运维人员,只要你搭建的服务是以集群的方式工作,那第一件事情就是应该让所有节点的时间保持一致。
    如果服务不依赖时间同步,如果你没有配置集群时间同步那倒无所谓,比如Hadoop服务如果各节点相差10分钟还是可以运行的,但是这对开发以后排错会产生困扰,因此我强烈建议大家配置集群时间同步。
    不仅如此,因为在使用集群搭建后期的HBase,Kudu等服务,若时间不同会直接导致你集群无法启动哟~

  博主推荐阅读:
    https://www.cnblogs.com/yinzhengjie/p/12292549.html

6>.搭建zookeeper集群

  博主推荐阅读:
    https://www.cnblogs.com/yinzhengjie2020/p/12501023.html

二.配置HDFS HA集群实战案例

  HDFS HA的官方文档:
    https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithQJM.html

1>.安装Hadoop运行环境

  博主推荐阅读:
    https://www.cnblogs.com/yinzhengjie2020/p/12422758.html
[root@hadoop101.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/
total 0
drwxr-xr-x  7 root root 145 May 12 05:59 apache-zookeeper-3.6.1-bin
drwxr-xr-x 11 root root 173 Mar 12 01:18 fully-mode
drwxr-xr-x 12 root root 184 Mar 12 04:35 hadoop-2.10.0            #该目录是我从官网下载的Linux发行版本的Hadoop源为文件。
drwxr-xr-x  7   10  143 245 Dec 16  2018 jdk1.8.0_201
drwxr-xr-x  9 root root 149 Mar 10 23:38 local-mode
drwxr-xr-x 11 root root 173 Mar 11 01:15 pseudo-mode
lrwxrwxrwx  1 root root  49 May 12 05:57 zookeeper -> /yinzhengjie/softwares/apache-zookeeper-3.6.1-bin
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cp -r /yinzhengjie/softwares/hadoop-2.10.0 /yinzhengjie/softwares/ha        #将Hadoop的源文件拷贝一份到本地的ha目录,后续的所有操作都在该目录执行。
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/ha
total 132
drwxr-xr-x 2 root root    194 May 12 21:38 bin
drwxr-xr-x 3 root root     17 May 12 21:39 data
drwxr-xr-x 3 root root     20 May 12 21:38 etc
drwxr-xr-x 2 root root    106 May 12 21:38 include
drwxr-xr-x 3 root root     20 May 12 21:38 lib
drwxr-xr-x 2 root root    239 May 12 21:38 libexec
-rw-r--r-- 1 root root 106210 May 12 21:38 LICENSE.txt
drwxr-xr-x 2 root root   4096 May 12 21:39 logs
-rw-r--r-- 1 root root  15841 May 12 21:39 NOTICE.txt
drwxr-xr-x 2 root root      6 May 12 21:39 pid
-rw-r--r-- 1 root root   1366 May 12 21:38 README.txt
drwxr-xr-x 3 root root   4096 May 12 21:39 sbin
drwxr-xr-x 4 root root     31 May 12 21:39 share
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cp -r /yinzhengjie/softwares/hadoop-2.10.0 /yinzhengjie/softwares/ha    #将Hadoop的源文件拷贝一份到本地的ha目录,后续的所有操作都在该目录执行。

2>.配置hadoop-env.sh

[root@hadoop101.yinzhengjie.org.cn ~]# echo $JAVA_HOME
/yinzhengjie/softwares/jdk1.8.0_201
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/ha/etc/hadoop/hadoop-env.sh      #指定JAVA_HOME路径 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/ha/etc/hadoop/hadoop-env.sh | egrep -v "^#|^$" | grep JAVA_HOME
export JAVA_HOME=/yinzhengjie/softwares/jdk1.8.0_201
[root@hadoop101.yinzhengjie.org.cn ~]# 

3>.配置core-site.xml

[root@hadoop101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/ha/etc/hadoop/core-site.xml 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/ha/etc/hadoop/core-site.xml 
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

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

<configuration>
    
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://yinzhengjie-hdfs-ha</value>
        <description>指定HDFS中NameNode的RPC地址,把两个NameNode的地址组装成一个名为yinzhengjie-hdfs的集群</description>
    </property>

    <property>
        <name>hadoop.tmp.dir</name>
        <value>/yinzhengjie/data/hdfs/ha</value>
        <description>指定Hadoop运行时产生文件的存储目录</description>
    </property>

</configuration>
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/ha/etc/hadoop/core-site.xml

4>.配置hdfs-site.xml

[root@hadoop101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml 
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

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

<configuration>

    <property>
        <name>dfs.replication</name>
        <value>3</value>
        <description>指定HDFS副本的数量</description>
    </property>

    <property>
        <name>dfs.nameservices</name>
        <value>yinzhengjie-hdfs-ha</value>
        <description>指定完全分布式集群的名称空间</description>
    </property>

    <property>
        <name>dfs.ha.namenodes.yinzhengjie-hdfs-ha</name>
        <value>namenode101,namenode106</value>
        <description>指定集群中NameNode节点别名</description>
    </property>

    <property>
        <name>dfs.namenode.rpc-address.yinzhengjie-hdfs-ha.namenode101</name>
        <value>hadoop101.yinzhengjie.org.cn:9000</value>
        <description>指定namenode101别名对应的真实主机及端口(绑定RPC通信地址),即您可以理解添加映射关系.</description>
    </property>

    <property>
        <name>dfs.namenode.rpc-address.yinzhengjie-hdfs-ha.namenode106</name>
        <value>hadoop106.yinzhengjie.org.cn:9000</value>
        <description>指定namenode106别名对应的真实主机及端口(绑定RPC通信地址),即您可以理解添加映射关系.</description>
    </property>

    <property>
        <name>dfs.namenode.http-address.yinzhengjie-hdfs-ha.namenode101</name>
        <value>hadoop101.yinzhengjie.org.cn:50070</value>
        <description>指定namenode101别名对应的真实WebUI地址(即http通信地址)</description>
    </property>

  
    <property>
        <name>dfs.namenode.http-address.yinzhengjie-hdfs-ha.namenode106</name>
        <value>hadoop106.yinzhengjie.org.cn:50070</value>
        <description>指定namenode106别名对应的真实WebUI地址(即http通信地址)</description>
    </property>

    <property>
        <name>dfs.namenode.shared.edits.dir</name>
        <value>qjournal://hadoop102.yinzhengjie.org.cn:8485;hadoop103.yinzhengjie.org.cn:8485;hadoop104.yinzhengjie.org.cn:8485/yinzhengjie-hdfs-ha</value>
        <description>指定NameNode元数据在JournalNode集群上的存放位置</description>
    </property>

    <property>
        <name>dfs.ha.fencing.methods</name>
        <value>sshfence</value>
        <description>配置隔离机制,即同一时刻只能有一台服务器对外响应</description>
    </property>

    <property>
        <name>dfs.ha.fencing.ssh.private-key-files</name>
        <value>/root/.ssh/id_rsa</value>
        <description>使用sshfence隔离机制时需要ssh无秘钥登录</description>
    </property>

    <property>
        <name>dfs.journalnode.edits.dir</name>
        <value>/yinzhengjie/data/hdfs/edits</value>
        <description>声明journalnode服务器本地存储目录</description>
    </property>

    <property>
        <name>dfs.client.failover.proxy.provider.yinzhengjie-hdfs-ha</name>
        <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
        <description>访问代理类,active配置失败自动切换实现方式</description>
    </property>

</configuration>
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml

5>.配置slaves

[root@hadoop101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/ha/etc/hadoop/slaves 
hadoop102.yinzhengjie.org.cn
hadoop103.yinzhengjie.org.cn
hadoop104.yinzhengjie.org.cn
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/ha/etc/hadoop/slaves        #指定datanode,JournalNode服务器列表

6>.配置Hadoop环境变量

[root@hadoop101.yinzhengjie.org.cn ~]# cat /etc/profile.d/hadoop.sh 
#Add ${HADOOP_HOME} by yinzhengjie
HADOOP_HOME=/yinzhengjie/softwares/ha
PATH=$PATH:${HADOOP_HOME}/bin:${HADOOP_HOME}/sbin
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cat /etc/profile.d/hadoop.sh

7>.将配置文件同步到其它节点

[root@hadoop101.yinzhengjie.org.cn ~]# cat `which rsync-hadoop.sh`
#!/bin/bash
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie
#EMAIL:y1053419035@qq.com

#判断用户是否传参
if [ $# -lt 1 ];then
        echo "请输入参数";
        exit
fi


#获取文件路径
file=$@

#获取子路径
filename=`basename $file`

#获取父路径
dirpath=`dirname $file`

#获取完整路径
cd $dirpath
fullpath=`pwd -P`

#同步文件到DataNode
for (( hostId=102;hostId<=106;hostId++ ))
do
        #使终端变绿色 
        tput setaf 2
        echo "******* [hadoop${hostId}.yinzhengjie.org.cn] node starts synchronizing [${file}] *******"
        #使终端变回原来的颜色,即白灰色
        tput setaf 7
        #远程执行命令
        rsync -lr $filename `whoami`@hadoop${hostId}.yinzhengjie.org.cn:${fullpath}
        #判断命令是否执行成功
        if [ $? == 0 ];then
                echo "命令执行成功"
        fi
done
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cat `which rsync-hadoop.sh`
[root@hadoop101.yinzhengjie.org.cn ~]# rsync-hadoop.sh /etc/profile.d/hadoop.sh 
******* [hadoop102.yinzhengjie.org.cn] node starts synchronizing [/etc/profile.d/hadoop.sh] *******
命令执行成功
******* [hadoop103.yinzhengjie.org.cn] node starts synchronizing [/etc/profile.d/hadoop.sh] *******
命令执行成功
******* [hadoop104.yinzhengjie.org.cn] node starts synchronizing [/etc/profile.d/hadoop.sh] *******
命令执行成功
******* [hadoop105.yinzhengjie.org.cn] node starts synchronizing [/etc/profile.d/hadoop.sh] *******
命令执行成功
******* [hadoop106.yinzhengjie.org.cn] node starts synchronizing [/etc/profile.d/hadoop.sh] *******
命令执行成功
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# rsync-hadoop.sh /etc/profile.d/hadoop.sh
[root@hadoop101.yinzhengjie.org.cn ~]# rsync-hadoop.sh /yinzhengjie/softwares/ha
******* [hadoop102.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha] *******
命令执行成功
******* [hadoop103.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha] *******
命令执行成功
******* [hadoop104.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha] *******
命令执行成功
******* [hadoop105.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha] *******
命令执行成功
******* [hadoop106.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha] *******
命令执行成功
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# rsync-hadoop.sh /yinzhengjie/softwares/ha

8>.启动JournalNode集群(会根据hdfs-site.xml文件定义的edits存储目录自动创建)

[root@hadoop101.yinzhengjie.org.cn ~]# hadoop-daemons.sh start journalnode     #如果您规定的JN节点和slaves文件中写的不一致,你也可以去相应的服务器上执行"hadoop-daemon.sh stop journalnode"命令以单独启动JN节点。
hadoop102.yinzhengjie.org.cn: starting journalnode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-journalnode-hadoop102.yinzhengjie.org.cn.out
hadoop104.yinzhengjie.org.cn: starting journalnode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-journalnode-hadoop104.yinzhengjie.org.cn.out
hadoop103.yinzhengjie.org.cn: starting journalnode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-journalnode-hadoop103.yinzhengjie.org.cn.out
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hadoop-daemons.sh start journalnode     #如果您规定的JN节点和slaves文件中写的不一致,你也可以去相应的服务器上执行"hadoop-daemon.sh stop journalnode"命令以单独启动JN节点。
[root@hadoop101.yinzhengjie.org.cn ~]# ansible jn -m shell -a "jps"
hadoop104.yinzhengjie.org.cn | SUCCESS | rc=0 >>
6228 JournalNode
6585 Jps

hadoop103.yinzhengjie.org.cn | SUCCESS | rc=0 >>
20064 JournalNode
20417 Jps

hadoop102.yinzhengjie.org.cn | SUCCESS | rc=0 >>
20565 Jps
20189 JournalNode

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible jn -m shell -a "jps"         #验证journalnode是否启动成功

9>.在hadoop101.yinzhengjie.org.cn上,对namenode进行格式化并启动

[root@hadoop101.yinzhengjie.org.cn ~]# hdfs namenode -format
20/05/13 07:29:56 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = hadoop101.yinzhengjie.org.cn/172.200.4.101
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 2.10.0
STARTUP_MSG:   classpath = /yinzhengjie/softwares/ha/etc/hadoop:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hadoop-auth-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-6.1.26.
jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jets3t-0.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/json-smart-1.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/slf4j-api-1.7.25.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/apacheds-i18n-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-lang3-3.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/httpclient-4.5.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-framework-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-recipes-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jcip-annotations-1.0-1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/stax-api-1.0-2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-json-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/nimbus-jose-jwt-4.41.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-configuration-1.6.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-net-3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-collections-3.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hamcrest-core-1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/activation-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jettison-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/stax2-api-3.1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/junit-4.11.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/httpcore-4.4.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-sslengine-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-client-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsch-0.1.54.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-math3-3.1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/gson-2.2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/mockito-all-1.8.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/zookeeper-3.4.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-beanutils-1.9.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsp-api-2.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-digester-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/woodstox-core-5.0.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hadoop-annotations-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-common-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-nfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jetty-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xercesImpl-2.12.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/okio-1.6.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xml-apis-1.4.01.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/okhttp-2.7.5.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-annotations-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/hadoop-hdfs-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-core-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/netty-all-4.0.23.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-databind-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-client-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-native-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-rbf-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-nfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-rbf-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-native-client-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/mssql-jdbc-6.2.1.jre7.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/api-util-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/json-io-2.5.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guice-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/aopalliance-1.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/geronimo-jcache_1.0_spec-1.0-alpha-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jets3t-0.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/json-smart-1.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/ehcache-3.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/java-util-1.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/apacheds-i18n-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-lang3-3.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/httpclient-4.5.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-jaxrs-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/fst-2.50.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jaxb-impl-2.2.3-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-framework-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-recipes-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-xc-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jcip-annotations-1.0-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/stax-api-1.0-2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/java-xmlbuilder-0.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-json-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/nimbus-jose-jwt-4.41.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-configuration-1.6.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-net-3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jaxb-api-2.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/api-asn1-api-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/javax.inject-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/metrics-core-3.0.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-collections-3.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/activation-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jettison-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/stax2-api-3.1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-guice-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/httpcore-4.4.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-sslengine-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-client-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsch-0.1.54.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guice-servlet-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-client-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-math3-3.1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/gson-2.2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/zookeeper-3.4.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/HikariCP-java7-2.4.12.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-beanutils-1.9.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsp-api-2.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-digester-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/woodstox-core-5.0.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-timeline-pluginstorage-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-tests-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-nodemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-web-proxy-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-api-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-sharedcachemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-registry-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-router-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/guice-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/aopalliance-1.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/javax.inject-1.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/junit-4.11.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-guice-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/guice-servlet-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/hadoop-annotations-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-app-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.10.0.jar:/contrib/capacity-scheduler/*.jarSTARTUP_MSG:   build = ssh://git.corp.linkedin.com:29418/hadoop/hadoop.git -r e2f1f118e465e787d8567dfa6e2f3b72a0eb9194; compiled by 'jhung' on 2019-10-22T19:10Z
STARTUP_MSG:   java = 1.8.0_201
************************************************************/
20/05/13 07:29:56 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
20/05/13 07:29:56 INFO namenode.NameNode: createNameNode [-format]
Formatting using clusterid: CID-69814f3d-d991-4a78-8934-a630b7137db7
20/05/13 07:29:57 INFO namenode.FSEditLog: Edit logging is async:true
20/05/13 07:29:57 INFO namenode.FSNamesystem: KeyProvider: null
20/05/13 07:29:57 INFO namenode.FSNamesystem: fsLock is fair: true
20/05/13 07:29:57 INFO namenode.FSNamesystem: Detailed lock hold time metrics enabled: false
20/05/13 07:29:57 INFO namenode.FSNamesystem: fsOwner             = root (auth:SIMPLE)
20/05/13 07:29:57 INFO namenode.FSNamesystem: supergroup          = supergroup
20/05/13 07:29:57 INFO namenode.FSNamesystem: isPermissionEnabled = true
20/05/13 07:29:57 INFO namenode.FSNamesystem: Determined nameservice ID: yinzhengjie-hdfs-ha
20/05/13 07:29:57 INFO namenode.FSNamesystem: HA Enabled: true
20/05/13 07:29:57 INFO common.Util: dfs.datanode.fileio.profiling.sampling.percentage set to 0. Disabling file IO profiling
20/05/13 07:29:57 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit: configured=1000, counted=60, effected=1000
20/05/13 07:29:57 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true
20/05/13 07:29:57 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000
20/05/13 07:29:57 INFO blockmanagement.BlockManager: The block deletion will start around 2020 May 13 07:29:57
20/05/13 07:29:57 INFO util.GSet: Computing capacity for map BlocksMap
20/05/13 07:29:57 INFO util.GSet: VM type       = 64-bit
20/05/13 07:29:57 INFO util.GSet: 2.0% max memory 889 MB = 17.8 MB
20/05/13 07:29:57 INFO util.GSet: capacity      = 2^21 = 2097152 entries
20/05/13 07:29:57 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false
20/05/13 07:29:57 WARN conf.Configuration: No unit for dfs.heartbeat.interval(3) assuming SECONDS
20/05/13 07:29:57 WARN conf.Configuration: No unit for dfs.namenode.safemode.extension(30000) assuming MILLISECONDS
20/05/13 07:29:57 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.threshold-pct = 0.9990000128746033
20/05/13 07:29:57 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.min.datanodes = 0
20/05/13 07:29:57 INFO blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.extension = 30000
20/05/13 07:29:57 INFO blockmanagement.BlockManager: defaultReplication         = 3
20/05/13 07:29:57 INFO blockmanagement.BlockManager: maxReplication             = 512
20/05/13 07:29:57 INFO blockmanagement.BlockManager: minReplication             = 1
20/05/13 07:29:57 INFO blockmanagement.BlockManager: maxReplicationStreams      = 2
20/05/13 07:29:57 INFO blockmanagement.BlockManager: replicationRecheckInterval = 3000
20/05/13 07:29:57 INFO blockmanagement.BlockManager: encryptDataTransfer        = false
20/05/13 07:29:57 INFO blockmanagement.BlockManager: maxNumBlocksToLog          = 1000
20/05/13 07:29:57 INFO namenode.FSNamesystem: Append Enabled: true
20/05/13 07:29:57 INFO namenode.FSDirectory: GLOBAL serial map: bits=24 maxEntries=16777215
20/05/13 07:29:57 INFO util.GSet: Computing capacity for map INodeMap
20/05/13 07:29:57 INFO util.GSet: VM type       = 64-bit
20/05/13 07:29:57 INFO util.GSet: 1.0% max memory 889 MB = 8.9 MB
20/05/13 07:29:57 INFO util.GSet: capacity      = 2^20 = 1048576 entries
20/05/13 07:29:57 INFO namenode.FSDirectory: ACLs enabled? false
20/05/13 07:29:57 INFO namenode.FSDirectory: XAttrs enabled? true
20/05/13 07:29:57 INFO namenode.NameNode: Caching file names occurring more than 10 times
20/05/13 07:29:57 INFO snapshot.SnapshotManager: Loaded config captureOpenFiles: falseskipCaptureAccessTimeOnlyChange: false
20/05/13 07:29:57 INFO util.GSet: Computing capacity for map cachedBlocks
20/05/13 07:29:57 INFO util.GSet: VM type       = 64-bit
20/05/13 07:29:57 INFO util.GSet: 0.25% max memory 889 MB = 2.2 MB
20/05/13 07:29:57 INFO util.GSet: capacity      = 2^18 = 262144 entries
20/05/13 07:29:57 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 10
20/05/13 07:29:57 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10
20/05/13 07:29:57 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25
20/05/13 07:29:57 INFO namenode.FSNamesystem: Retry cache on namenode is enabled
20/05/13 07:29:57 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
20/05/13 07:29:57 INFO util.GSet: Computing capacity for map NameNodeRetryCache
20/05/13 07:29:57 INFO util.GSet: VM type       = 64-bit
20/05/13 07:29:57 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB
20/05/13 07:29:57 INFO util.GSet: capacity      = 2^15 = 32768 entries
20/05/13 07:29:57 INFO namenode.FSImage: Allocated new BlockPoolId: BP-536854561-172.200.4.101-1589326197709
20/05/13 07:29:57 INFO common.Storage: Storage directory /yinzhengjie/data/hdfs/ha/dfs/name has been successfully formatted.
20/05/13 07:29:57 INFO namenode.FSImageFormatProtobuf: Saving image file /yinzhengjie/data/hdfs/ha/dfs/name/current/fsimage.ckpt_0000000000000000000 using no compression
20/05/13 07:29:57 INFO namenode.FSImageFormatProtobuf: Image file /yinzhengjie/data/hdfs/ha/dfs/name/current/fsimage.ckpt_0000000000000000000 of size 323 bytes saved in 0 seconds .
20/05/13 07:29:57 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
20/05/13 07:29:57 INFO namenode.FSImage: FSImageSaver clean checkpoint: txid = 0 when meet shutdown.
20/05/13 07:29:57 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at hadoop101.yinzhengjie.org.cn/172.200.4.101
************************************************************/
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hdfs namenode -format
[root@hadoop101.yinzhengjie.org.cn ~]# jps -l
6438 sun.tools.jps.Jps
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hadoop-daemon.sh start namenode
starting namenode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-namenode-hadoop101.yinzhengjie.org.cn.out
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# jps -l
6475 org.apache.hadoop.hdfs.server.namenode.NameNode
6555 sun.tools.jps.Jps
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hadoop-daemon.sh start namenode

10>.在hadoop106.yinzhengjie.org.cn上同步hadoop101.yinzhengjie.org.cn的元数据信息并启动

[root@hadoop106.yinzhengjie.org.cn ~]# hdfs namenode -bootstrapStandby
20/05/13 07:37:14 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = hadoop106.yinzhengjie.org.cn/172.200.4.106
STARTUP_MSG:   args = [-bootstrapStandby]
STARTUP_MSG:   version = 2.10.0
STARTUP_MSG:   classpath = /yinzhengjie/softwares/ha/etc/hadoop:/yinzhengjie/softwares/ha/share/hadoop/common/lib/activation-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/apacheds-i18n-
2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/junit-4.11.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/nimbus-jose-jwt-4.41.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-beanutils-1.9.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jettison-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-collections-3.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/slf4j-api-1.7.25.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-configuration-1.6.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-digester-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-lang3-3.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/stax-api-1.0-2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/stax2-api-3.1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-math3-3.1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-net-3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/woodstox-core-5.0.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-client-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-framework-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/zookeeper-3.4.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-recipes-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/gson-2.2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-sslengine-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hadoop-annotations-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hadoop-auth-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hamcrest-core-1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/httpclient-4.5.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/httpcore-4.4.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/mockito-all-1.8.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jcip-annotations-1.0-1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-json-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jets3t-0.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsch-0.1.54.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/json-smart-1.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsp-api-2.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-common-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-nfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/hadoop-hdfs-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-annotations-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-core-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-databind-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jetty-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/netty-all-4.0.23.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/okhttp-2.7.5.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/okio-1.6.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xercesImpl-2.12.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xml-apis-1.4.01.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-client-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-native-client-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-native-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-nfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-rbf-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-rbf-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/HikariCP-java7-2.4.12.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/zookeeper-3.4.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/activation-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/aopalliance-1.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsch-0.1.54.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/apacheds-i18n-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/json-io-2.5.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/api-asn1-api-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/json-smart-1.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/api-util-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsp-api-2.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-beanutils-1.9.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jcip-annotations-1.0-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-collections-3.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-client-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-configuration-1.6.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-digester-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/metrics-core-3.0.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-lang3-3.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/mssql-jdbc-6.2.1.jre7.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-math3-3.1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-net-3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/nimbus-jose-jwt-4.41.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-client-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-framework-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-recipes-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/ehcache-3.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/fst-2.50.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jaxb-impl-2.2.3-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/geronimo-jcache_1.0_spec-1.0-alpha-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/gson-2.2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guice-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guice-servlet-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/httpclient-4.5.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/httpcore-4.4.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/stax-api-1.0-2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-jaxrs-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-sslengine-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/stax2-api-3.1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-xc-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/java-util-1.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/woodstox-core-5.0.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/java-xmlbuilder-0.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/javax.inject-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jaxb-api-2.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-guice-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-json-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jets3t-0.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jettison-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-api-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-registry-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-nodemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-router-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-sharedcachemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-tests-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-timeline-pluginstorage-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-web-proxy-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/aopalliance-1.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/guice-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/guice-servlet-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/hadoop-annotations-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/javax.inject-1.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-guice-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/junit-4.11.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-app-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar:/contrib/capacity-scheduler/*.jarSTARTUP_MSG:   build = ssh://git.corp.linkedin.com:29418/hadoop/hadoop.git -r e2f1f118e465e787d8567dfa6e2f3b72a0eb9194; compiled by 'jhung' on 2019-10-22T19:10Z
STARTUP_MSG:   java = 1.8.0_201
************************************************************/
20/05/13 07:37:14 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
20/05/13 07:37:15 INFO namenode.NameNode: createNameNode [-bootstrapStandby]
20/05/13 07:37:15 INFO ha.BootstrapStandby: Found nn: namenode101, ipc: hadoop101.yinzhengjie.org.cn/172.200.4.101:9000
=====================================================
About to bootstrap Standby ID namenode106 from:
           Nameservice ID: yinzhengjie-hdfs-ha
        Other Namenode ID: namenode101
  Other NN's HTTP address: http://hadoop101.yinzhengjie.org.cn:50070
  Other NN's IPC  address: hadoop101.yinzhengjie.org.cn/172.200.4.101:9000
             Namespace ID: 1347405511
            Block pool ID: BP-536854561-172.200.4.101-1589326197709
               Cluster ID: CID-69814f3d-d991-4a78-8934-a630b7137db7
           Layout version: -63
       isUpgradeFinalized: true
=====================================================
20/05/13 07:37:15 INFO common.Storage: Storage directory /yinzhengjie/data/hdfs/ha/dfs/name has been successfully formatted.
20/05/13 07:37:15 INFO namenode.FSEditLog: Edit logging is async:true
20/05/13 07:37:15 INFO namenode.TransferFsImage: Opening connection to http://hadoop101.yinzhengjie.org.cn:50070/imagetransfer?getimage=1&txid=0&storageInfo=-63:1347405511:1589326197709:CID-69814f3d-d991-4a78-8934-a630b7137db7&bootstrapstandby=true
20/05/13 07:37:15 INFO common.Util: Combined time for fsimage download and fsync to all disks took 0.00s. The fsimage download took 0.00s at 0.00 KB/s. Synchronous (fsync) write to disk of /yinzhengjie/data/hdfs/ha/dfs/name/current/fsimage.ckpt_0000000000000000000 took 
0.00s.20/05/13 07:37:15 INFO namenode.TransferFsImage: Downloaded file fsimage.ckpt_0000000000000000000 size 323 bytes.
20/05/13 07:37:15 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at hadoop106.yinzhengjie.org.cn/172.200.4.106
************************************************************/
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# hdfs namenode -bootstrapStandby        #该步骤也会根据配置文件(hdfs-site.xml)创建相应的目录
[root@hadoop106.yinzhengjie.org.cn ~]# jps
6881 Jps
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# hadoop-daemon.sh start namenode
starting namenode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-namenode-hadoop106.yinzhengjie.org.cn.out
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# jps
6908 NameNode
6988 Jps
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# hadoop-daemon.sh start namenode

11>.在node101.yinzhengjie.org.cn上,启动所有datanode

[root@hadoop101.yinzhengjie.org.cn ~]# hadoop-daemons.sh start datanode
hadoop102.yinzhengjie.org.cn: starting datanode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-datanode-hadoop102.yinzhengjie.org.cn.out
hadoop103.yinzhengjie.org.cn: starting datanode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-datanode-hadoop103.yinzhengjie.org.cn.out
hadoop104.yinzhengjie.org.cn: starting datanode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-datanode-hadoop104.yinzhengjie.org.cn.out
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hadoop-daemons.sh start datanode
[root@hadoop101.yinzhengjie.org.cn ~]# ansible dn -m shell -a "jps"
hadoop103.yinzhengjie.org.cn | SUCCESS | rc=0 >>
20064 JournalNode
20145 DataNode
20273 Jps

hadoop102.yinzhengjie.org.cn | SUCCESS | rc=0 >>
20422 Jps
20282 DataNode
20189 JournalNode

hadoop104.yinzhengjie.org.cn | SUCCESS | rc=0 >>
6228 JournalNode
6312 DataNode
6441 Jps

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible dn -m shell -a "jps"          #验证DN节点是否都启动成功

12>.将node101.yinzhengjie.org.cn节点切换为Active

[root@hadoop101.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode101         #查看Namenode ID为namenode101是否为Active状态。
standby
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode106
standby
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hdfs haadmin -transitionToActive namenode101        #将Namenode ID为namenode101的namenode服务器切换为Active。
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode101          
active
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode106
standby
[root@hadoop101.yinzhengjie.org.cn ~]# 

13>.停止HDFS集群运行

[root@hadoop101.yinzhengjie.org.cn ~]# stop-dfs.sh 
Stopping namenodes on [hadoop101.yinzhengjie.org.cn hadoop106.yinzhengjie.org.cn]
hadoop101.yinzhengjie.org.cn: stopping namenode
hadoop106.yinzhengjie.org.cn: stopping namenode
hadoop102.yinzhengjie.org.cn: stopping datanode
hadoop103.yinzhengjie.org.cn: stopping datanode
hadoop104.yinzhengjie.org.cn: stopping datanode
Stopping journal nodes [hadoop103.yinzhengjie.org.cn hadoop104.yinzhengjie.org.cn hadoop102.yinzhengjie.org.cn]
hadoop103.yinzhengjie.org.cn: stopping journalnode
hadoop102.yinzhengjie.org.cn: stopping journalnode
hadoop104.yinzhengjie.org.cn: stopping journalnode
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# stop-dfs.sh

三.配置HDFS HA 自动故障转移实战案例

  使用命令hdfs haadmin -failover可以手动进行故障转移,在该模式下,即使现役NameNode已经失效,系统也不会自动从现役NameNode转移到待机NameNode,因此不适合生产环境使用,接下来下我们一起习如何配置部署HA自动进行故障转移。

  自动故障转移为HDFS部署增加了两个新组件:ZooKeeper和ZKFailoverController(ZKFC)进程。ZooKeeper是维护少量协调数据,通知客户端这些数据的改变和监视客户端故障的高可用服务。关于HDFS HA的原理请大家自行查阅相关资料。

  博主推荐阅读:
    https://www.cnblogs.com/yinzhengjie2020/p/12507810.html

1>.启动zookeeper集群

[root@hadoop101.yinzhengjie.org.cn ~]# zookeeper.sh start
启动服务
========== zookeeper101.yinzhengjie.org.cn zkServer.sh start ================
/yinzhengjie/softwares/jdk1.8.0_201/bin/java
ZooKeeper JMX enabled by default
Using config: /yinzhengjie/softwares/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
========== zookeeper102.yinzhengjie.org.cn zkServer.sh start ================
/yinzhengjie/softwares/jdk1.8.0_201/bin/java
ZooKeeper JMX enabled by default
Using config: /yinzhengjie/softwares/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
========== zookeeper103.yinzhengjie.org.cn zkServer.sh start ================
/yinzhengjie/softwares/jdk1.8.0_201/bin/java
ZooKeeper JMX enabled by default
Using config: /yinzhengjie/softwares/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# zookeeper.sh start
[root@hadoop101.yinzhengjie.org.cn ~]# zookeeper.sh status
查看状态
========== zookeeper101.yinzhengjie.org.cn zkServer.sh status ================
/yinzhengjie/softwares/jdk1.8.0_201/bin/java
ZooKeeper JMX enabled by default
Using config: /yinzhengjie/softwares/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower
========== zookeeper102.yinzhengjie.org.cn zkServer.sh status ================
/yinzhengjie/softwares/jdk1.8.0_201/bin/java
ZooKeeper JMX enabled by default
Using config: /yinzhengjie/softwares/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: leader
========== zookeeper103.yinzhengjie.org.cn zkServer.sh status ================
/yinzhengjie/softwares/jdk1.8.0_201/bin/java
ZooKeeper JMX enabled by default
Using config: /yinzhengjie/softwares/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# zookeeper.sh status

2>.配置hdfs-site.xml

[root@hadoop101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml 
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

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

<configuration>

    <property>
        <name>dfs.replication</name>
        <value>3</value>
        <description>指定HDFS副本的数量</description>
    </property>

    <property>
    <name>dfs.nameservices</name>
    <value>yinzhengjie-hdfs-ha</value>
        <description>指定完全分布式集群的名称空间</description>
    </property>

    <property>
    <name>dfs.ha.namenodes.yinzhengjie-hdfs-ha</name>
    <value>namenode101,namenode106</value>
        <description>指定集群中NameNode节点别名</description>
    </property>

    <property>
    <name>dfs.namenode.rpc-address.yinzhengjie-hdfs-ha.namenode101</name>
    <value>hadoop101.yinzhengjie.org.cn:9000</value>
        <description>指定namenode101别名对应的真实主机及端口(绑定RPC通信地址),即您可以理解添加映射关系.</description>
    </property>

    <property>
    <name>dfs.namenode.rpc-address.yinzhengjie-hdfs-ha.namenode106</name>
    <value>hadoop106.yinzhengjie.org.cn:9000</value>
        <description>指定namenode106别名对应的真实主机及端口(绑定RPC通信地址),即您可以理解添加映射关系.</description>
    </property>

    <property>
    <name>dfs.namenode.http-address.yinzhengjie-hdfs-ha.namenode101</name>
    <value>hadoop101.yinzhengjie.org.cn:50070</value>
        <description>指定namenode101别名对应的真实WebUI地址(即http通信地址)</description>
    </property>

  
    <property>
    <name>dfs.namenode.http-address.yinzhengjie-hdfs-ha.namenode106</name>
    <value>hadoop106.yinzhengjie.org.cn:50070</value>
        <description>指定namenode106别名对应的真实WebUI地址(即http通信地址)</description>
    </property>

    <property>
    <name>dfs.namenode.shared.edits.dir</name>
    <value>qjournal://hadoop103.yinzhengjie.org.cn:8485;hadoop104.yinzhengjie.org.cn:8485;hadoop102.yinzhengjie.org.cn:8485/yinzhengjie-hdfs-ha</value>
        <description>指定NameNode元数据在JournalNode集群上的存放位置</description>
    </property>

    <property>
    <name>dfs.ha.fencing.methods</name>
    <value>sshfence</value>
        <description>配置隔离机制,即同一时刻只能有一台服务器对外响应</description>
    </property>

    <property>
    <name>dfs.ha.fencing.ssh.private-key-files</name>
    <value>/root/.ssh/id_rsa</value>
        <description>使用sshfence隔离机制时需要ssh无秘钥登录</description>
    </property>

    <property>
    <name>dfs.journalnode.edits.dir</name>
    <value>/yinzhengjie/data/hdfs/edits</value>
        <description>声明journalnode服务器本地存储目录</description>
    </property>

    <property>
      <name>dfs.client.failover.proxy.provider.yinzhengjie-hdfs-ha</name>
    <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
        <description>访问代理类,active配置失败自动切换实现方式</description>
    </property>

    <property>
    <name>dfs.ha.automatic-failover.enabled</name>
    <value>true</value>
        <description>启动自动容灾功能</description>
    </property>

</configuration>
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml

3>.配置core-site.xml

[root@hadoop101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/ha/etc/hadoop/core-site.xml 
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# cat /yinzhengjie/softwares/ha/etc/hadoop/core-site.xml 
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

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

<configuration>
    
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://yinzhengjie-hdfs-ha</value>
        <description>指定HDFS中NameNode的RPC地址,把两个NameNode的地址组装成一个名为yinzhengjie-hdfs的集群</description>
    </property>

    <property>
        <name>hadoop.tmp.dir</name>
        <value>/yinzhengjie/data/hdfs/ha</value>
        <description>指定Hadoop运行时产生文件的存储目录</description>
    </property>

    <property>
    <name>ha.zookeeper.quorum</name>
    <value>hadoop101.yinzhengjie.org.cn:2181,hadoop102.yinzhengjie.org.cn:2181,hadoop103.yinzhengjie.org.cn:2181</value>
        <description>指定zookeeper集群的地址</description>
    </property>


</configuration>
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# vim /yinzhengjie/softwares/ha/etc/hadoop/core-site.xml

4>.将配置文件同步到其它节点

[root@hadoop101.yinzhengjie.org.cn ~]# rsync-hadoop.sh /yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml 
******* [hadoop102.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml] *******
命令执行成功
******* [hadoop103.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml] *******
命令执行成功
******* [hadoop104.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml] *******
命令执行成功
******* [hadoop105.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml] *******
命令执行成功
******* [hadoop106.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml] *******
命令执行成功
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# rsync-hadoop.sh /yinzhengjie/softwares/ha/etc/hadoop/hdfs-site.xml
[root@hadoop101.yinzhengjie.org.cn ~]# rsync-hadoop.sh /yinzhengjie/softwares/ha/etc/hadoop/core-site.xml 
******* [hadoop102.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha/etc/hadoop/core-site.xml] *******
命令执行成功
******* [hadoop103.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha/etc/hadoop/core-site.xml] *******
命令执行成功
******* [hadoop104.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha/etc/hadoop/core-site.xml] *******
命令执行成功
******* [hadoop105.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha/etc/hadoop/core-site.xml] *******
命令执行成功
******* [hadoop106.yinzhengjie.org.cn] node starts synchronizing [/yinzhengjie/softwares/ha/etc/hadoop/core-site.xml] *******
命令执行成功
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# rsync-hadoop.sh /yinzhengjie/softwares/ha/etc/hadoop/core-site.xml

5>.初始化HDFS HA在Zookeeper中状态

[root@hadoop101.yinzhengjie.org.cn ~]# hdfs zkfc -formatZK
20/05/13 08:48:44 INFO tools.DFSZKFailoverController: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting DFSZKFailoverController
STARTUP_MSG:   host = hadoop101.yinzhengjie.org.cn/172.200.4.101
STARTUP_MSG:   args = [-formatZK]
STARTUP_MSG:   version = 2.10.0
STARTUP_MSG:   classpath = /yinzhengjie/softwares/ha/etc/hadoop:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hadoop-auth-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-6.1.26.
jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jets3t-0.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/json-smart-1.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/slf4j-api-1.7.25.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/apacheds-i18n-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-lang3-3.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/httpclient-4.5.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-framework-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-recipes-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jcip-annotations-1.0-1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/stax-api-1.0-2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-json-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/nimbus-jose-jwt-4.41.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-configuration-1.6.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-net-3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-collections-3.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hamcrest-core-1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/activation-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jettison-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/stax2-api-3.1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/junit-4.11.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/httpcore-4.4.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-sslengine-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-client-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsch-0.1.54.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-math3-3.1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/gson-2.2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/mockito-all-1.8.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/zookeeper-3.4.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-beanutils-1.9.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsp-api-2.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-digester-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/woodstox-core-5.0.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hadoop-annotations-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-common-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-nfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jetty-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xercesImpl-2.12.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/okio-1.6.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xml-apis-1.4.01.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/okhttp-2.7.5.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-annotations-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/hadoop-hdfs-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-core-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/netty-all-4.0.23.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-databind-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-client-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-native-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-rbf-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-nfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-rbf-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-native-client-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/mssql-jdbc-6.2.1.jre7.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/api-util-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/json-io-2.5.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guice-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/aopalliance-1.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/geronimo-jcache_1.0_spec-1.0-alpha-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jets3t-0.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/json-smart-1.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/ehcache-3.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/java-util-1.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/apacheds-i18n-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-lang3-3.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/httpclient-4.5.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-jaxrs-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/fst-2.50.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jaxb-impl-2.2.3-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-framework-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-recipes-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-xc-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jcip-annotations-1.0-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/stax-api-1.0-2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/java-xmlbuilder-0.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-json-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/nimbus-jose-jwt-4.41.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-configuration-1.6.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-net-3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jaxb-api-2.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/api-asn1-api-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/javax.inject-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/metrics-core-3.0.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-collections-3.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/activation-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jettison-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/stax2-api-3.1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-guice-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/httpcore-4.4.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-sslengine-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-client-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsch-0.1.54.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guice-servlet-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-client-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-math3-3.1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/gson-2.2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/zookeeper-3.4.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/HikariCP-java7-2.4.12.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-beanutils-1.9.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsp-api-2.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-digester-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/woodstox-core-5.0.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-timeline-pluginstorage-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-tests-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-nodemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-web-proxy-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-api-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-sharedcachemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-registry-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-router-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/guice-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/aopalliance-1.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/javax.inject-1.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/junit-4.11.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-guice-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/guice-servlet-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/hadoop-annotations-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-app-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.10.0.jar:/contrib/capacity-scheduler/*.jarSTARTUP_MSG:   build = ssh://git.corp.linkedin.com:29418/hadoop/hadoop.git -r e2f1f118e465e787d8567dfa6e2f3b72a0eb9194; compiled by 'jhung' on 2019-10-22T19:10Z
STARTUP_MSG:   java = 1.8.0_201
************************************************************/
20/05/13 08:48:44 INFO tools.DFSZKFailoverController: registered UNIX signal handlers for [TERM, HUP, INT]
20/05/13 08:48:45 INFO tools.DFSZKFailoverController: Failover controller configured for NameNode NameNode at hadoop101.yinzhengjie.org.cn/172.200.4.101:9000
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.9-1757313, built on 08/23/2016 06:50 GMT
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:host.name=hadoop101.yinzhengjie.org.cn
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:java.version=1.8.0_201
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:java.home=/yinzhengjie/softwares/jdk1.8.0_201/jre
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:java.class.path=/yinzhengjie/softwares/ha/etc/hadoop:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hadoop-auth-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-core-1.9.jar:/yinzhengji
e/softwares/ha/share/hadoop/common/lib/jetty-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jets3t-0.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/json-smart-1.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/slf4j-api-1.7.25.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/apacheds-i18n-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-lang3-3.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/httpclient-4.5.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-framework-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-recipes-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jcip-annotations-1.0-1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/stax-api-1.0-2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-json-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/nimbus-jose-jwt-4.41.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-configuration-1.6.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-net-3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-collections-3.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hamcrest-core-1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/activation-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jettison-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/stax2-api-3.1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/junit-4.11.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/httpcore-4.4.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-sslengine-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/curator-client-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsch-0.1.54.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-math3-3.1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/gson-2.2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/mockito-all-1.8.5.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/zookeeper-3.4.9.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-beanutils-1.9.4.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/jsp-api-2.1.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/commons-digester-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/woodstox-core-5.0.3.jar:/yinzhengjie/softwares/ha/share/hadoop/common/lib/hadoop-annotations-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-common-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/common/hadoop-nfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jetty-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xercesImpl-2.12.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/okio-1.6.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/xml-apis-1.4.01.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/okhttp-2.7.5.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-annotations-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/hadoop-hdfs-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-core-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/netty-all-4.0.23.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-databind-2.7.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-client-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-native-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-rbf-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-nfs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-rbf-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/hdfs/hadoop-hdfs-native-client-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/mssql-jdbc-6.2.1.jre7.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/api-util-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/json-io-2.5.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guice-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/aopalliance-1.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/geronimo-jcache_1.0_spec-1.0-alpha-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jets3t-0.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/json-smart-1.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/ehcache-3.3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/java-util-1.9.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/apacheds-i18n-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-lang3-3.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/xmlenc-0.52.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/httpclient-4.5.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-jaxrs-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/fst-2.50.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jaxb-impl-2.2.3-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-framework-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/servlet-api-2.5.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-recipes-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-xc-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jcip-annotations-1.0-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/stax-api-1.0-2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guava-11.0.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/java-xmlbuilder-0.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-json-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-lang-2.6.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/nimbus-jose-jwt-4.41.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-configuration-1.6.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-net-3.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jaxb-api-2.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/api-asn1-api-1.0.0-M20.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/javax.inject-1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/metrics-core-3.0.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-collections-3.2.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsr305-3.0.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/activation-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jettison-1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-cli-1.2.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/stax2-api-3.1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-guice-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/httpcore-4.4.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-sslengine-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/curator-client-2.7.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsch-0.1.54.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/guice-servlet-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jersey-client-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-math3-3.1.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/gson-2.2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-codec-1.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/zookeeper-3.4.9.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-logging-1.1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jetty-util-6.1.26.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/htrace-core4-4.1.0-incubating.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/HikariCP-java7-2.4.12.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-beanutils-1.9.4.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/jsp-api-2.1.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/commons-digester-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/lib/woodstox-core-5.0.3.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-timeline-pluginstorage-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-client-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-tests-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-nodemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-web-proxy-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-api-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-sharedcachemanager-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-registry-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/yarn/hadoop-yarn-server-router-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-core-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/commons-io-2.4.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/guice-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/aopalliance-1.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/netty-3.10.6.Final.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/snappy-java-1.0.5.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/avro-1.7.7.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/asm-3.2.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/commons-compress-1.19.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-server-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jackson-mapper-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/paranamer-2.3.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/javax.inject-1.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/junit-4.11.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/protobuf-java-2.5.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jersey-guice-1.9.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/log4j-1.2.17.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/guice-servlet-3.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/leveldbjni-all-1.8.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/jackson-core-asl-1.9.13.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/lib/hadoop-annotations-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-common-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.10.0-tests.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-app-2.10.0.jar:/yinzhengjie/softwares/ha/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.10.0.jar:/contrib/capacity-scheduler/*.jar20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/yinzhengjie/softwares/ha/lib/native
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:os.version=3.10.0-957.el7.x86_64
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:user.name=root
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:user.home=/root
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Client environment:user.dir=/root
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=hadoop101.yinzhengjie.org.cn:2181,hadoop102.yinzhengjie.org.cn:2181,hadoop103.yinzhengjie.org.cn:2181 sessionTimeout=10000 watcher=org.apache.hadoop.ha.ActiveStandbyElector$WatcherWi
thClientRef@353d077220/05/13 08:48:45 INFO zookeeper.ClientCnxn: Opening socket connection to server hadoop103.yinzhengjie.org.cn/172.200.4.103:2181. Will not attempt to authenticate using SASL (unknown error)
20/05/13 08:48:45 INFO zookeeper.ClientCnxn: Socket connection established to hadoop103.yinzhengjie.org.cn/172.200.4.103:2181, initiating session
20/05/13 08:48:45 INFO zookeeper.ClientCnxn: Session establishment complete on server hadoop103.yinzhengjie.org.cn/172.200.4.103:2181, sessionid = 0x670005cae0090000, negotiated timeout = 10000
20/05/13 08:48:45 INFO ha.ActiveStandbyElector: Successfully created /hadoop-ha/yinzhengjie-hdfs-ha in ZK.
20/05/13 08:48:45 INFO ha.ActiveStandbyElector: Session connected.
20/05/13 08:48:45 INFO zookeeper.ZooKeeper: Session: 0x670005cae0090000 closed
20/05/13 08:48:45 INFO zookeeper.ClientCnxn: EventThread shut down for session: 0x670005cae0090000
20/05/13 08:48:45 INFO tools.DFSZKFailoverController: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down DFSZKFailoverController at hadoop101.yinzhengjie.org.cn/172.200.4.101
************************************************************/
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hdfs zkfc -formatZK                  #该操作会在zookeeper集群上创建名为"/hadoop-ha/yinzhengjie-hdfs-ha"的znode。

6>.启动HDFS服务

[root@hadoop101.yinzhengjie.org.cn ~]# ansible all -m shell -a 'jps'
hadoop106.yinzhengjie.org.cn | SUCCESS | rc=0 >>
7541 Jps

hadoop101.yinzhengjie.org.cn | SUCCESS | rc=0 >>
8214 ZooKeeperMain
8727 Jps
7386 QuorumPeerMain

hadoop104.yinzhengjie.org.cn | SUCCESS | rc=0 >>
6976 Jps

hadoop103.yinzhengjie.org.cn | SUCCESS | rc=0 >>
20650 QuorumPeerMain
21036 Jps

hadoop102.yinzhengjie.org.cn | SUCCESS | rc=0 >>
20800 QuorumPeerMain
21196 Jps

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible all -m shell -a 'jps'
[root@hadoop101.yinzhengjie.org.cn ~]# start-dfs.sh 
Starting namenodes on [hadoop101.yinzhengjie.org.cn hadoop106.yinzhengjie.org.cn]
hadoop101.yinzhengjie.org.cn: starting namenode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-namenode-hadoop101.yinzhengjie.org.cn.out
hadoop106.yinzhengjie.org.cn: starting namenode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-namenode-hadoop106.yinzhengjie.org.cn.out
hadoop103.yinzhengjie.org.cn: starting datanode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-datanode-hadoop103.yinzhengjie.org.cn.out
hadoop104.yinzhengjie.org.cn: starting datanode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-datanode-hadoop104.yinzhengjie.org.cn.out
hadoop102.yinzhengjie.org.cn: starting datanode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-datanode-hadoop102.yinzhengjie.org.cn.out
Starting journal nodes [hadoop103.yinzhengjie.org.cn hadoop104.yinzhengjie.org.cn hadoop102.yinzhengjie.org.cn]
hadoop103.yinzhengjie.org.cn: starting journalnode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-journalnode-hadoop103.yinzhengjie.org.cn.out
hadoop104.yinzhengjie.org.cn: starting journalnode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-journalnode-hadoop104.yinzhengjie.org.cn.out
hadoop102.yinzhengjie.org.cn: starting journalnode, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-journalnode-hadoop102.yinzhengjie.org.cn.out
Starting ZK Failover Controllers on NN hosts [hadoop101.yinzhengjie.org.cn hadoop106.yinzhengjie.org.cn]
hadoop101.yinzhengjie.org.cn: starting zkfc, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-zkfc-hadoop101.yinzhengjie.org.cn.out
hadoop106.yinzhengjie.org.cn: starting zkfc, logging to /yinzhengjie/softwares/ha/logs/hadoop-root-zkfc-hadoop106.yinzhengjie.org.cn.out
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# start-dfs.sh
[root@hadoop101.yinzhengjie.org.cn ~]# ansible all -m shell -a 'jps'
hadoop104.yinzhengjie.org.cn | SUCCESS | rc=0 >>
7232 Jps
7016 DataNode
7117 JournalNode

hadoop103.yinzhengjie.org.cn | SUCCESS | rc=0 >>
21076 DataNode
21177 JournalNode
20650 QuorumPeerMain
21293 Jps

hadoop101.yinzhengjie.org.cn | SUCCESS | rc=0 >>
9301 Jps
8214 ZooKeeperMain
8857 NameNode
7386 QuorumPeerMain
9162 DFSZKFailoverController

hadoop102.yinzhengjie.org.cn | SUCCESS | rc=0 >>
20800 QuorumPeerMain
21236 DataNode
21336 JournalNode
21448 Jps

hadoop106.yinzhengjie.org.cn | SUCCESS | rc=0 >>
7792 Jps
7681 DFSZKFailoverController
7580 NameNode

[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ansible all -m shell -a 'jps'

7>.将Active NameNode进程kill

[root@hadoop101.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode101
standby
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode106
active
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# ssh hadoop106.yinzhengjie.org.cn
Last login: Wed May 13 09:16:58 2020 from 172.200.4.101
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# jps
7681 DFSZKFailoverController
8168 Jps
7580 NameNode
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# kill -9 7580
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# jps
7681 DFSZKFailoverController
8183 Jps
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# exit
logout
Connection to hadoop106.yinzhengjie.org.cn closed.
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode101
active
[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode106
20/05/13 09:38:37 INFO ipc.Client: Retrying connect to server: hadoop106.yinzhengjie.org.cn/172.200.4.1
06:9000. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=1, sleepTime=1000 MILLISECONDS)Operation failed: Call From hadoop101.yinzhengjie.org.cn/172.200.4.101 to hadoop106.yinzhengjie.org.cn:
9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused[root@hadoop101.yinzhengjie.org.cn ~]# 
[root@hadoop101.yinzhengjie.org.cn ~]# 

8>.将Active NameNode机器重启

[root@hadoop106.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode101
standby
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode106
active
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# reboot 

Connection closed by foreign host.

Disconnected from remote host(hadoop106.yinzhengjie.org.cn) at 10:04:00.

Type `help' to learn how to use Xshell prompt.
[c:~]$ 
[root@hadoop106.yinzhengjie.org.cn ~]# reboot              #重启完成后集群恢复使用

9>.将Active NameNode对应的

[root@hadoop106.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode101
standby
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode106
active
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# init 0

Connection closed by foreign host.

Disconnected from remote host(hadoop106.yinzhengjie.org.cn) at 10:15:29.

Type `help' to learn how to use Xshell prompt.
[c:~]$ 
[root@hadoop106.yinzhengjie.org.cn ~]# init 0          #关掉Active服务器后,虽然Standby接管了NameNode但这个集群不可用,因为StandBy无法远程连接到已关机Active NamtNode服务器,从而无法验证之前旧的Active Namenode被隔离。

10>.将Active NameNode节点的DFSZKFailoverController进程kill

[root@hadoop106.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode101
standby
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode106
active
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# jps
5728 DFSZKFailoverController
5415 NameNode
6108 Jps
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# kill -9 5728
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# jps
5415 NameNode
6120 Jps
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode101
standby
[root@hadoop106.yinzhengjie.org.cn ~]# 
[root@hadoop106.yinzhengjie.org.cn ~]# hdfs haadmin -getServiceState namenode106
standby
[root@hadoop106.yinzhengjie.org.cn ~]# 

11>.总结

  关于HDFS HA在zookeeper集群的znode说明如下:  
    /hadoop-ha/yinzhengjie-hdfs-ha/ActiveBreadCrumb:       一个永久性的znode,正常情况下它保存的数据也是当前Active NameNode是谁,但当Active NameNode异常退出(比如服务器断电),此时Standby Namenode接管,     /hadoop-ha/yinzhengjie-hdfs-ha/ActiveStandbyElectorLock:       一个临时性的znode,内部的数据保存的当前的Active NameNode是谁。当Active NameNode节点出现故障(比如ZKFC进程挂掉),该临时节点会随之删除,此时被监听的Standby Namenode会注册一个同名的namenode。

  温馨提示:
    在Hadoop2.x版本引入了高可用技术,但是需要注意的是,当有任何一个服务器关机时,整个集群是不可用的。这一点我们在上面已经测试过了。不过这一点在Hadoop 3.x得到了缓解,因为Hadoop 3.x支持3个及以上的NameNode。
    
  博主推荐阅读:
    https://www.cnblogs.com/yinzhengjie2020/p/12507810.html
原文地址:https://www.cnblogs.com/yinzhengjie2020/p/12508145.html