Class SshFenceByTcpPort

java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.ha.SshFenceByTcpPort
All Implemented Interfaces:
Configurable, FenceMethod

public class SshFenceByTcpPort extends Configured implements FenceMethod
This fencing implementation sshes to the target node and uses fuser to kill the process listening on the service's TCP port. This is more accurate than using "jps" since it doesn't require parsing, and will work even if there are multiple service processes running on the same machine.

It returns a successful status code if:

  • fuser indicates it successfully killed a process, or
  • nc -z indicates that nothing is listening on the target port

This fencing mechanism is configured as following in the fencing method list: sshfence([[username][:ssh-port]]) where the optional argument specifies the username and port to use with ssh.

In order to achieve passwordless SSH, the operator must also configure dfs.ha.fencing.ssh.private-key-files to point to an SSH key that has passphrase-less access to the given username and host.