org.apache.hadoop.mapred
Class SshFenceByTcpPort

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

public class SshFenceByTcpPort
extends org.apache.hadoop.conf.Configured
implements org.apache.hadoop.ha.FenceMethod

NOTE: This is a copy of org.apache.hadoop.ha.SshFenceByTcpPort that uses MR-specific configuration options (since the original is hardcoded to HDFS configuration properties so there is no way to run MR and HDFS fencing using a single configuration file). 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:

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.


Nested Class Summary
static class SshFenceByTcpPort.Args
          Container for the parsed arg line for this fencing method.
 
Field Summary
static java.lang.String CONF_CONNECT_TIMEOUT_KEY
           
static java.lang.String CONF_IDENTITIES_KEY
           
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
SshFenceByTcpPort()
           
 
Method Summary
 void checkArgs(java.lang.String argStr)
          Verify that the argument, if given, in the conf is parseable.
 boolean tryFence(org.apache.hadoop.ha.HAServiceTarget target, java.lang.String argsStr)
           
 
Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG

CONF_CONNECT_TIMEOUT_KEY

public static final java.lang.String CONF_CONNECT_TIMEOUT_KEY
See Also:
Constant Field Values

CONF_IDENTITIES_KEY

public static final java.lang.String CONF_IDENTITIES_KEY
See Also:
Constant Field Values
Constructor Detail

SshFenceByTcpPort

public SshFenceByTcpPort()
Method Detail

checkArgs

public void checkArgs(java.lang.String argStr)
               throws org.apache.hadoop.ha.BadFencingConfigurationException
Verify that the argument, if given, in the conf is parseable.

Specified by:
checkArgs in interface org.apache.hadoop.ha.FenceMethod
Throws:
org.apache.hadoop.ha.BadFencingConfigurationException

tryFence

public boolean tryFence(org.apache.hadoop.ha.HAServiceTarget target,
                        java.lang.String argsStr)
                 throws org.apache.hadoop.ha.BadFencingConfigurationException
Specified by:
tryFence in interface org.apache.hadoop.ha.FenceMethod
Throws:
org.apache.hadoop.ha.BadFencingConfigurationException


Copyright © 2009 The Apache Software Foundation