Class DiskBalancerCluster
Please Note : Semantics of inclusionList and exclusionLists.
If a non-empty inclusionList is specified then the diskBalancer assumes that the user is only interested in processing that list of nodes. This node list is checked against the exclusionList and only the nodes in inclusionList but not in exclusionList is processed.
if inclusionList is empty, then we assume that all live nodes in the nodes is to be processed by diskBalancer. In that case diskBalancer will avoid any nodes specified in the exclusionList but will process all nodes in the cluster.
In other words, an empty inclusionList is means all the nodes otherwise only a given list is processed and ExclusionList is always honored.
-
Constructor Summary
ConstructorsConstructorDescriptionEmpty Constructor needed by Jackson.DiskBalancerCluster(ClusterConnector connector) Constructs a DiskBalancerCluster. -
Method Summary
Modifier and TypeMethodDescriptioncomputePlan(double thresholdPercent) Compute plan takes a node and constructs a planner that creates a plan that we would like to follow.voidcreateSnapshot(String snapShotName) Writes a snapshot of the cluster to the specified directory.Returns the current ExclusionList.Gets the Inclusion list.getNodeByIPAddress(String ipAddresss) Returns a node by IP Address.getNodeByName(String hostName) Returns a node by hostName.getNodeByUUID(String uuid) Returns a node by UUID.getNodes()Gets all DataNodes in the Cluster.Returns the Nodes to Process which is the real list of nodes processed by diskBalancer.Returns th output path for this cluster.floatReturns the threshold value.static DiskBalancerClusterParses a Json string and converts to DiskBalancerCluster.voidreadClusterInfo connects to the cluster and reads the node's data.voidsetExclusionList(Set<String> excludedNodes) sets the list of nodes to exclude from process of diskBalancer.voidsetInclusionList(Set<String> includeNodes) Sets the inclusionList.voidsetNodes(List<DiskBalancerDataNode> clusterNodes) Sets the list of nodes of this cluster.voidsetNodesToProcess(List<DiskBalancerDataNode> dnNodesToProcess) Sets the nodes to process.voidSets the output path for this run.voidsetThreshold(float thresholdPercent) Sets the threshold value.toJson()returns a serialized json string.
-
Constructor Details
-
DiskBalancerCluster
public DiskBalancerCluster()Empty Constructor needed by Jackson. -
DiskBalancerCluster
Constructs a DiskBalancerCluster.- Parameters:
connector- - ClusterConnector- Throws:
IOException
-
-
Method Details
-
parseJson
Parses a Json string and converts to DiskBalancerCluster.- Parameters:
json- - Json String- Returns:
- DiskBalancerCluster
- Throws:
IOException
-
readClusterInfo
readClusterInfo connects to the cluster and reads the node's data. This data is used as basis of rest of computation in DiskBalancerCluster- Throws:
Exception
-
getNodes
Gets all DataNodes in the Cluster.- Returns:
- Array of DisKBalancerDataNodes
-
setNodes
Sets the list of nodes of this cluster.- Parameters:
clusterNodes- List of Nodes
-
getExclusionList
Returns the current ExclusionList.- Returns:
- List of Nodes that are excluded from diskBalancer right now.
-
setExclusionList
sets the list of nodes to exclude from process of diskBalancer.- Parameters:
excludedNodes- - exclusionList of nodes.
-
getThreshold
public float getThreshold()Returns the threshold value. This is used for indicating how much skew is acceptable, This is expressed as a percentage. For example to say 20% skew between volumes is acceptable set this value to 20.- Returns:
- float
-
setThreshold
public void setThreshold(float thresholdPercent) Sets the threshold value.- Parameters:
thresholdPercent- - float - in percentage
-
getInclusionList
Gets the Inclusion list.- Returns:
- List of machine to be processed by diskBalancer.
-
setInclusionList
Sets the inclusionList.- Parameters:
includeNodes- - set of machines to be processed by diskBalancer.
-
toJson
returns a serialized json string.- Returns:
- String - json
- Throws:
IOException
-
getNodesToProcess
Returns the Nodes to Process which is the real list of nodes processed by diskBalancer.- Returns:
- List of DiskBalancerDataNodes
-
setNodesToProcess
Sets the nodes to process.- Parameters:
dnNodesToProcess- - List of DataNodes to process
-
getOutput
Returns th output path for this cluster. -
setOutput
Sets the output path for this run.- Parameters:
output- - Path
-
createSnapshot
Writes a snapshot of the cluster to the specified directory.- Parameters:
snapShotName- - name of the snapshot- Throws:
IOException
-
computePlan
Compute plan takes a node and constructs a planner that creates a plan that we would like to follow.This function creates a thread pool and executes a planner on each node that we are supposed to plan for. Each of these planners return a NodePlan that we can persist or schedule for execution with a diskBalancer Executor.
- Parameters:
thresholdPercent- - in percentage- Returns:
- list of NodePlans
-
getNodeByUUID
Returns a node by UUID.- Parameters:
uuid- - Node's UUID- Returns:
- DiskBalancerDataNode.
-
getNodeByIPAddress
Returns a node by IP Address.- Parameters:
ipAddresss- - IP address String.- Returns:
- DiskBalancerDataNode.
-
getNodeByName
Returns a node by hostName.- Parameters:
hostName- - HostName.- Returns:
- DiskBalancerDataNode.
-