Class ShellCommandFencer

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

public class ShellCommandFencer extends Configured implements FenceMethod
Fencing method that runs a shell command. It should be specified in the fencing configuration like:
shell(/path/to/my/script.sh arg1 arg2 ...)
The string between '(' and ')' is passed directly to a bash shell (cmd.exe on Windows) and may not include any closing parentheses.

The shell command will be run with an environment set up to contain all of the current Hadoop configuration variables, with the '_' character replacing any '.' or '-' characters in the configuration keys.

If the shell command returns an exit code of 0, the fencing is determined to be successful. If it returns any other exit code, the fencing was not successful and the next fencing method in the list will be attempted.

Note: this fencing method does not implement any timeout. If timeouts are necessary, they should be implemented in the shell script itself (eg by forking a subshell to kill its parent in some number of seconds).

  • Constructor Details

    • ShellCommandFencer

      public ShellCommandFencer()
  • Method Details