|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.conf.Configured
org.apache.hadoop.ha.ShellCommandFencer
public class ShellCommandFencer
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 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 '.' 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 Summary | |
---|---|
ShellCommandFencer()
|
Method Summary | |
---|---|
void |
checkArgs(String args)
Verify that the given fencing method's arguments are valid. |
boolean |
tryFence(HAServiceTarget target,
String cmd)
Attempt to fence the target node. |
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 |
Constructor Detail |
---|
public ShellCommandFencer()
Method Detail |
---|
public void checkArgs(String args) throws BadFencingConfigurationException
FenceMethod
checkArgs
in interface FenceMethod
args
- the arguments provided in the configuration. This may
be null if the operator did not configure any arguments.
BadFencingConfigurationException
- if the arguments are invalidpublic boolean tryFence(HAServiceTarget target, String cmd)
FenceMethod
tryFence
in interface FenceMethod
cmd
- the configured arguments, which were checked at startup by
FenceMethod.checkArgs(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |