Namanode 高可用 主备节点切换
Posted 闭关苦炼内功
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Namanode 高可用 主备节点切换相关的知识,希望对你有一定的参考价值。
注意:
namenode 的节点 对应 的 主机节点:
nn1 bigdata02
nn2 bigdtata03
- 查看 namenode 节点状态 active/standby
ssh bigdata02 "su - hdfs -c 'hdfs haadmin -getServiceState nn1'"
ssh bigdata03 "su - hdfs -c 'hdfs haadmin -getServiceState nn2'"
root@bigdata01 ~/bin # cat ha_nn1.sh
#!/bin/bash
ssh bigdata02 "su - hdfs -c 'hdfs haadmin -getServiceState nn1'"
root@bigdata01 ~/bin #
root@bigdata01 ~/bin # ./ha_nn1.sh
active
root@bigdata01 ~/bin #
root@bigdata01 ~/bin # cat ha_nn2.sh
#!/bin/bash
ssh bigdata03 "su - hdfs -c 'hdfs haadmin -getServiceState nn2'"
root@bigdata01 ~/bin #
root@bigdata01 ~/bin # ./ha_nn2.sh
standby
root@bigdata01 ~/bin #
- 主备节点切换
ssh bigdata02 "su - hdfs -c 'hdfs haadmin -transitionToActive --forcemanual nn1'"
ssh bigdata02 "su - hdfs -c 'hdfs haadmin -transitionToActive --forcemanual nn2'"
root@bigdata01 ~/bin # cat ha_standby2active_nn1.sh
#!/bin/bash
# active nn1
ssh bigdata02 "su - hdfs -c 'hdfs haadmin -transitionToActive --forcemanual nn1'"
# active nn2
# ssh bigdata02 "su - hdfs -c 'hdfs haadmin -transitionToActive --forcemanual nn2'"
root@bigdata01 ~/bin #
root@bigdata01 ~/bin # cat ha_standby2active_nn2.sh
#!/bin/bash
# active nn1
# ssh bigdata02 "su - hdfs -c 'hdfs haadmin -transitionToActive --forcemanual nn1'"
# active nn2
ssh bigdata02 "su - hdfs -c 'hdfs haadmin -transitionToActive --forcemanual nn2'"
root@bigdata01 ~/bin #
以上是关于Namanode 高可用 主备节点切换的主要内容,如果未能解决你的问题,请参考以下文章
pgpool-ii4.1.2 高可用集群[主备切换]配置部分