Package org.apache.hadoop.ha
Class HAServiceTarget
java.lang.Object
org.apache.hadoop.ha.HAServiceTarget
Represents a target of the client side HA administration commands.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddFencingParameters(Map<String, String> ret) Hook to allow subclasses to add any parameters they would like to expose to fencing implementations/scripts.abstract voidabstract InetSocketAddressabstract org.apache.hadoop.ha.NodeFencerReturns an optional separate RPC server address for health checks at the target node.getHealthMonitorProxy(Configuration conf, int timeoutMs) Returns a proxy to connect to the target HA service for health monitoring.getHealthMonitorProxy(Configuration conf, int timeoutMs, int retries) getProxy(Configuration conf, int timeoutMs) abstract InetSocketAddressorg.apache.hadoop.ha.ZKFCProtocolgetZKFCProxy(Configuration conf, int timeoutMs) booleanvoidboolean
-
Constructor Details
-
HAServiceTarget
public HAServiceTarget()
-
-
Method Details
-
getAddress
- Returns:
- the IPC address of the target node.
-
getHealthMonitorAddress
Returns an optional separate RPC server address for health checks at the target node. If defined, then this address is used by the health monitor for theHAServiceProtocol.monitorHealth()andHAServiceProtocol.getServiceStatus()calls. This can be useful for separating out these calls onto separate RPC handlers to protect against resource exhaustion in the main RPC handler pool. If null (which is the default implementation), then all RPC calls go to the address defined bygetAddress().- Returns:
- IPC address of the lifeline RPC server on the target node, or null if no lifeline RPC server is used
-
getZKFCAddress
- Returns:
- the IPC address of the ZKFC on the target node
-
getFencer
public abstract org.apache.hadoop.ha.NodeFencer getFencer()- Returns:
- a Fencer implementation configured for this target node
-
checkFencingConfigured
- Throws:
BadFencingConfigurationException- if the fencing configuration appears to be invalid. This is divorced from the abovegetFencer()method so that the configuration can be checked during the pre-flight phase of failover.
-
getProxy
- Parameters:
timeoutMs- timeout in milliseconds.conf- Configuration.- Returns:
- a proxy to connect to the target HA Service.
- Throws:
IOException- raised on errors performing I/O.
-
setTransitionTargetHAStatus
-
getTransitionTargetHAStatus
-
getHealthMonitorProxy
public HAServiceProtocol getHealthMonitorProxy(Configuration conf, int timeoutMs) throws IOException Returns a proxy to connect to the target HA service for health monitoring. IfgetHealthMonitorAddress()is implemented to return a non-null address, then this proxy will connect to that address. Otherwise, the returned proxy defaults to usinggetAddress(), which means this method's behavior is identical togetProxy(Configuration, int).- Parameters:
conf- configuration.timeoutMs- timeout in milliseconds- Returns:
- a proxy to connect to the target HA service for health monitoring
- Throws:
IOException- if there is an error
-
getHealthMonitorProxy
public HAServiceProtocol getHealthMonitorProxy(Configuration conf, int timeoutMs, int retries) throws IOException - Throws:
IOException
-
getZKFCProxy
public org.apache.hadoop.ha.ZKFCProtocol getZKFCProxy(Configuration conf, int timeoutMs) throws IOException - Parameters:
conf- configuration.timeoutMs- timeout in milliseconds.- Returns:
- a proxy to the ZKFC which is associated with this HA service.
- Throws:
IOException- raised on errors performing I/O.
-
getFencingParameters
-
addFencingParameters
Hook to allow subclasses to add any parameters they would like to expose to fencing implementations/scripts. Fencing methods are free to use this map as they see fit -- notably, the shell script implementation takes each entry, prepends 'target_', substitutes '_' for '.' and '-', and adds it to the environment of the script. Subclass implementations should be sure to delegate to the superclass implementation as well as adding their own keys.- Parameters:
ret- map which can be mutated to pass parameters to the fencer
-
isAutoFailoverEnabled
public boolean isAutoFailoverEnabled()- Returns:
- true if auto failover should be considered enabled
-
supportObserver
public boolean supportObserver()- Returns:
- true if this target supports the Observer state, false otherwise.
-