Hadoop高可用配置文件hdfs-site.xml之dfs.ha.fencing.methods说明

dfs.ha.fencing.methods配置有sshfence和shell两种方法:

sshfence:防止namenode脑裂,当脑裂时,会自动通过ssh到old-active将其杀掉,将standby切换为active。

                   但是只能在网络通畅时有效,一旦ipdown后fencing方法返回false,standby不会自动切换active,

                   只能手动执行 hdfs haadmin failover namenode1 namenode2 进行切;所以需要加配shell(/bin/true)。

                   想要kill掉namenode active后standby自动切换为active,需要安装psmisc(fuser);因为sshfence方式

                   是使用fuser通过ssh登录old-active进行诊断从而切换active/standby的。

shell(/bin/true):如果出现故障并且fencing方法返回false,则会继续执行shell(true),从而active/standby自动切换。

                            fencing方法返回true,则不会执行shell。

具体配置如下

<property>

  <name>dfs.ha.fencing.methods</name>

扫描二维码关注公众号,回复: 4240110 查看本文章

  <value>

    sshfence

    shell(/bin/true)

  </value>

</property>

猜你喜欢

转载自blog.csdn.net/FromTheWind/article/details/84106341
今日推荐