Quorum Journal实现HDFS HA配置dfs.ha.fencing.methods

1. 为什么使用Quorum Journal方式实现hdfs ha配置dfs.ha.fencing.methods只需要写shell(true)?

2. dfs.ha.fencing.methods
表示:a list of scripts or Java classes which will be used to fence the Active NameNode during a failover

而配置为shell(true)就是直接返回隔离成功,即表示没进行任何操作,为什么不会导致脑裂现象的发生,这是因为Quorun Journal方式内置了fencing功能,不需要实现单独的fencing机制(epoch number解决互斥问题)。
而如果使用共享存储NAS+NFS那种方式的话,就需要配置具体的真正有fencing功能的,比如:sshfence,下面是sshfence的说明:

sshfence - SSH to the Active NameNode and kill the process
The sshfence option SSHes to the target node and uses fuser to kill the process listening on the service’s TCP port. In order for this fencing option to work, it must be able to SSH to the target node without providing a passphrase. Thus, one must also configure the dfs.ha.fencing.ssh.private-key-files option, which is a comma-separated list of SSH private key files. 即配置sshfence需要两个namenode之间配置无密码认证,如下:

   
      dfs.ha.fencing.methods
      sshfence
   

   
      dfs.ha.fencing.ssh.private-key-files
      /home/exampleuser/.ssh/id_rsa
   

但如果只配置sshfence,如果在机器宕机后不可达,则sshfence会返回false,即fence失败,所以得要配置成:

   
      dfs.ha.fencing.methods
      sshfence,shell(true)
   

这样子配置,顺序执行时,如果可达就执行sshfence执行杀死namenode后返回true,不可达就直接shell(true)返回true。

 

你可能感兴趣的:(hadoop,hadoop,hdfs)