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>