public class DiskBalancerCluster extends Object
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 and Description |
---|
DiskBalancerCluster()
Empty Constructor needed by Jackson.
|
DiskBalancerCluster(ClusterConnector connector)
Constructs a DiskBalancerCluster.
|
Modifier and Type | Method and Description |
---|---|
List<NodePlan> |
computePlan(double thresholdPercent)
Compute plan takes a node and constructs a planner that creates a plan that
we would like to follow.
|
void |
createSnapshot(String snapShotName)
Writes a snapshot of the cluster to the specified directory.
|
Set<String> |
getExclusionList()
Returns the current ExclusionList.
|
Set<String> |
getInclusionList()
Gets the Inclusion list.
|
DiskBalancerDataNode |
getNodeByIPAddress(String ipAddresss)
Returns a node by IP Address.
|
DiskBalancerDataNode |
getNodeByName(String hostName)
Returns a node by hostName.
|
DiskBalancerDataNode |
getNodeByUUID(String uuid)
Returns a node by UUID.
|
List<DiskBalancerDataNode> |
getNodes()
Gets all DataNodes in the Cluster.
|
List<DiskBalancerDataNode> |
getNodesToProcess()
Returns the Nodes to Process which is the real list of nodes processed by
diskBalancer.
|
String |
getOutput()
Returns th output path for this cluster.
|
float |
getThreshold()
Returns the threshold value.
|
static DiskBalancerCluster |
parseJson(String json)
Parses a Json string and converts to DiskBalancerCluster.
|
void |
readClusterInfo()
readClusterInfo connects to the cluster and reads the node's data.
|
void |
setExclusionList(Set<String> excludedNodes)
sets the list of nodes to exclude from process of diskBalancer.
|
void |
setInclusionList(Set<String> includeNodes)
Sets the inclusionList.
|
void |
setNodes(List<DiskBalancerDataNode> clusterNodes)
Sets the list of nodes of this cluster.
|
void |
setNodesToProcess(List<DiskBalancerDataNode> dnNodesToProcess)
Sets the nodes to process.
|
void |
setOutput(String output)
Sets the output path for this run.
|
void |
setThreshold(float thresholdPercent)
Sets the threshold value.
|
String |
toJson()
returns a serialized json string.
|
public DiskBalancerCluster()
public DiskBalancerCluster(ClusterConnector connector) throws IOException
connector
- - ClusterConnectorIOException
public static DiskBalancerCluster parseJson(String json) throws IOException
json
- - Json StringIOException
public void readClusterInfo() throws Exception
Exception
public List<DiskBalancerDataNode> getNodes()
public void setNodes(List<DiskBalancerDataNode> clusterNodes)
clusterNodes
- List of Nodespublic Set<String> getExclusionList()
public void setExclusionList(Set<String> excludedNodes)
excludedNodes
- - exclusionList of nodes.public float getThreshold()
public void setThreshold(float thresholdPercent)
thresholdPercent
- - float - in percentagepublic Set<String> getInclusionList()
public void setInclusionList(Set<String> includeNodes)
includeNodes
- - set of machines to be processed by diskBalancer.public String toJson() throws IOException
IOException
public List<DiskBalancerDataNode> getNodesToProcess()
public void setNodesToProcess(List<DiskBalancerDataNode> dnNodesToProcess)
dnNodesToProcess
- - List of DataNodes to processpublic String getOutput()
public void setOutput(String output)
output
- - Pathpublic void createSnapshot(String snapShotName) throws IOException
snapShotName
- - name of the snapshotIOException
public List<NodePlan> computePlan(double thresholdPercent)
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.
thresholdPercent
- - in percentagepublic DiskBalancerDataNode getNodeByUUID(String uuid)
uuid
- - Node's UUIDpublic DiskBalancerDataNode getNodeByIPAddress(String ipAddresss)
ipAddresss
- - IP address String.public DiskBalancerDataNode getNodeByName(String hostName)
hostName
- - HostName.Copyright © 2008–2022 Apache Software Foundation. All rights reserved.