public class SshFenceByTcpPort
extends org.apache.hadoop.conf.Configured
implements org.apache.hadoop.ha.FenceMethod
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
mapred.ha.fencing.ssh.private-key-files
to point to an
SSH key that has passphrase-less access to the given username and host.
Modifier and Type | Class and Description |
---|---|
static class |
SshFenceByTcpPort.Args
Container for the parsed arg line for this fencing method.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONF_CONNECT_TIMEOUT_KEY |
static java.lang.String |
CONF_IDENTITIES_KEY |
static org.apache.commons.logging.Log |
LOG |
Constructor and Description |
---|
SshFenceByTcpPort() |
public static final org.apache.commons.logging.Log LOG
public static final java.lang.String CONF_CONNECT_TIMEOUT_KEY
public static final java.lang.String CONF_IDENTITIES_KEY
public void checkArgs(java.lang.String argStr) throws org.apache.hadoop.ha.BadFencingConfigurationException
checkArgs
in interface org.apache.hadoop.ha.FenceMethod
org.apache.hadoop.ha.BadFencingConfigurationException
public boolean tryFence(org.apache.hadoop.ha.HAServiceTarget target, java.lang.String argsStr) throws org.apache.hadoop.ha.BadFencingConfigurationException
tryFence
in interface org.apache.hadoop.ha.FenceMethod
org.apache.hadoop.ha.BadFencingConfigurationException
Copyright © 2009 The Apache Software Foundation