Package org.apache.hadoop.ha
Class PowerShellFencer
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.ha.PowerShellFencer
- All Implemented Interfaces:
Configurable,FenceMethod
Fencer method that uses PowerShell to remotely connect to a machine and kill
the required process. This only works in Windows.
Fencing method uses PowerShell command. It should be specified
in the fencing configuration like:
powershell(NameNode)
The argument passed to this fencer should be a unique string in the
"CommandLine" attribute for the "java.exe" process. For example, the full
path for the Namenode: "org.apache.hadoop.hdfs.server.namenode.NameNode".
The administrator can also shorten the name to "Namenode" if it's unique.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidVerify that the given fencing method's arguments are valid.booleantryFence(HAServiceTarget target, String argsStr) Attempt to fence the target node.Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
-
Constructor Details
-
PowerShellFencer
public PowerShellFencer()
-
-
Method Details
-
checkArgs
Description copied from interface:FenceMethodVerify that the given fencing method's arguments are valid.- Specified by:
checkArgsin interfaceFenceMethod- Parameters:
argStr- the arguments provided in the configuration. This may be null if the operator did not configure any arguments.- Throws:
BadFencingConfigurationException- if the arguments are invalid
-
tryFence
public boolean tryFence(HAServiceTarget target, String argsStr) throws BadFencingConfigurationException Description copied from interface:FenceMethodAttempt to fence the target node.- Specified by:
tryFencein interfaceFenceMethod- Parameters:
target- the target of the service to fenceargsStr- the configured arguments, which were checked at startup byFenceMethod.checkArgs(String)- Returns:
- true if fencing was successful, false if unsuccessful or indeterminate
- Throws:
BadFencingConfigurationException- if the configuration was determined to be invalid only at runtime
-