public class ZKClusterCoordinatorDriver extends Object implements AMRegistrar
build()
method
to create and start the ZK service. Obtains the initial set of
Drillbits (which should be empty for a YARN-defined cluster) which can be
retrieved after building.
Maintains the ZK connection and monitors for disconnect. This class simply
detects a disconnect timeout, it does not send a disconnect event itself to
avoid creating a timer thread just for this purpose. Instead, the caller can
poll hasFailed()
.
Defaults match those in Drill. (Actual Drill defaults are not yet used due to code incompatibility issues.)
AMRegistrar.AMRegistrationException
Constructor and Description |
---|
ZKClusterCoordinatorDriver() |
Modifier and Type | Method and Description |
---|---|
void |
addDrillbitListener(DrillbitStatusListener listener) |
static String |
asString(CoordinationProtos.DrillbitEndpoint bit)
Convenience method to convert a Drillbit to a string.
|
ZKClusterCoordinatorDriver |
build()
Builds and starts the ZooKeeper cluster coordinator, translating any errors
that occur.
|
void |
close() |
void |
deregister() |
static String |
formatKey(String host,
int userPort,
int controlPort,
int dataPort) |
List<CoordinationProtos.DrillbitEndpoint> |
getInitialEndpoints()
Returns the set of Drillbits registered at the time of the
build()
call. |
long |
getLostConnectionDurationMs() |
boolean |
hasFailed()
Reports our best guess as to whether ZK has failed.
|
void |
register(String amHost,
int amPort,
String appId) |
void |
removeDrillbitListener(DrillbitStatusListener listener) |
ZKClusterCoordinatorDriver |
setConnect(String connect)
Specify connect string in the form: host:/zkRoot/clusterId
|
ZKClusterCoordinatorDriver |
setConnect(String connect,
String zkRoot,
String clusterId) |
ZKClusterCoordinatorDriver |
setConnectTimeoutMs(int ms) |
ZKClusterCoordinatorDriver |
setFailureTimoutMs(int ms) |
ZKClusterCoordinatorDriver |
setMaxStartWaitMs(int ms) |
ZKClusterCoordinatorDriver |
setPorts(int userPort,
int controlPort,
int dataPort) |
ZKClusterCoordinatorDriver |
setRetryCount(int n) |
ZKClusterCoordinatorDriver |
setRetryDelayMs(int ms) |
protected void |
stateChanged(org.apache.curator.framework.state.ConnectionState newState)
Translate ZK connection events into a connected/disconnected state along
with the time of the first disconnect not followed by a connect.
|
String |
toKey(String host) |
public ZKClusterCoordinatorDriver setConnect(String connect) throws ZKConfigException
connect
- ZKClusterCoordinatorDriver
.ZKConfigException
public ZKClusterCoordinatorDriver setConnect(String connect, String zkRoot, String clusterId)
public ZKClusterCoordinatorDriver setRetryCount(int n)
public ZKClusterCoordinatorDriver setConnectTimeoutMs(int ms)
public ZKClusterCoordinatorDriver setRetryDelayMs(int ms)
public ZKClusterCoordinatorDriver setMaxStartWaitMs(int ms)
public ZKClusterCoordinatorDriver setFailureTimoutMs(int ms)
public ZKClusterCoordinatorDriver setPorts(int userPort, int controlPort, int dataPort)
public ZKClusterCoordinatorDriver build() throws ZKRuntimeException
ZKClusterCoordinatorDriver
.ZKRuntimeException
- if ZK startup failspublic void addDrillbitListener(DrillbitStatusListener listener)
public void removeDrillbitListener(DrillbitStatusListener listener)
public List<CoordinationProtos.DrillbitEndpoint> getInitialEndpoints()
build()
call. Should be empty for a cluster managed by YARN.build()
call.public static String asString(CoordinationProtos.DrillbitEndpoint bit)
bit
- protected void stateChanged(org.apache.curator.framework.state.ConnectionState newState)
newState
- public boolean hasFailed()
public long getLostConnectionDurationMs()
public void close()
public void register(String amHost, int amPort, String appId) throws AMRegistrar.AMRegistrationException
register
in interface AMRegistrar
AMRegistrar.AMRegistrationException
public void deregister()
deregister
in interface AMRegistrar
Copyright © 1970 The Apache Software Foundation. All rights reserved.