public class

ZKHelixAdmin

extends Object
implements HelixAdmin
java.lang.Object
   ↳ org.apache.helix.manager.zk.ZKHelixAdmin

Summary

Constants
String CONNECTION_TIMEOUT
Public Constructors
ZKHelixAdmin(ZkClient zkClient)
ZKHelixAdmin(String zkAddress)
Public Methods
void addAlert(String clusterName, String alertName)
Add an alert to a cluster
boolean addCluster(String clusterName, boolean recreateIfExists)
Add a cluster
boolean addCluster(String clusterName)
Add a cluster
void addClusterToGrandCluster(String clusterName, String grandCluster)
Add a cluster and also add this cluster as a resource group in the super cluster
void addIdealState(String clusterName, String resourceName, String idealStateFile)
Add ideal state using a json format file
void addInstance(String clusterName, InstanceConfig instanceConfig)
Add an instance to a cluster
void addInstanceTag(String clusterName, String instanceName, String tag)
void addResource(String clusterName, String resourceName, int partitions, String stateModelRef)
Add a resource to a cluster, using the default ideal state mode AUTO
void addResource(String clusterName, String resourceName, int partitions, String stateModelRef, String rebalancerMode)
Add a resource to a cluster
void addResource(String clusterName, String resourceName, IdealState idealstate)
void addResource(String clusterName, String resourceName, int partitions, String stateModelRef, String rebalancerMode, int bucketSize)
Add a resource to a cluster, using a bucket size > 1
void addResource(String clusterName, String resourceName, int partitions, String stateModelRef, String rebalancerMode, int bucketSize, int maxPartitionsPerInstance)
Add a resource to a cluster, using a bucket size > 1
void addStat(String clusterName, String statName)
Add a statistics to a cluster
void addStateModelDef(String clusterName, String stateModelDef, StateModelDefinition stateModel)
Add a state model definition
void addStateModelDef(String clusterName, String stateModelDefName, String stateModelDefFile)
Add state model definition using a json format file
void close()
Release resources
void dropAlert(String clusterName, String alertName)
Drop an alert from a cluster
void dropCluster(String clusterName)
Drop a cluster
void dropInstance(String clusterName, InstanceConfig instanceConfig)
Drop an instance from a cluster
void dropResource(String clusterName, String resourceName)
Drop a resource from a cluster
void dropStat(String clusterName, String statName)
Drop statistics from a cluster
void enableCluster(String clusterName, boolean enabled)
Disable or enable a cluster
void enableInstance(String clusterName, String instanceName, boolean enabled)
Disable or enable an instance
void enablePartition(boolean enabled, String clusterName, String instanceName, String resourceName, List<String> partitionNames)
Disable or enable a list of partitions on an instance
List<String> getClusters()
Get a list of clusters under "/"
Map<StringString> getConfig(HelixConfigScope scope, List<String> keys)
Get configuration values
List<String> getConfigKeys(HelixConfigScope scope)
Get configuration keys
ClusterConstraints getConstraints(String clusterName, ClusterConstraints.ConstraintType constraintType)
Get all constraints for a type
InstanceConfig getInstanceConfig(String clusterName, String instanceName)
Get an instance config
List<String> getInstancesInCluster(String clusterName)
Get a list of instances under a cluster
List<String> getInstancesInClusterWithTag(String clusterName, String tag)
ExternalView getResourceExternalView(String clusterName, String resourceName)
Get external view for a resource
IdealState getResourceIdealState(String clusterName, String resourceName)
Get ideal state for a resource
List<String> getResourcesInCluster(String clusterName)
Get a list of resources in a cluster
StateModelDefinition getStateModelDef(String clusterName, String stateModelName)
Get a state model definition in a cluster
List<String> getStateModelDefs(String clusterName)
Get a list of state model definitions in a cluster
void rebalance(String clusterName, String resourceName, int replica, List<String> instances)
void rebalance(String clusterName, String resourceName, int replica)
Rebalance a resource in cluster
void rebalance(String clusterName, IdealState currentIdealState, List<String> instanceNames)
Takes the existing idealstate as input and computes newIdealState such that the partition movement is minimized.
void rebalance(String clusterName, String resourceName, int replica, String keyPrefix, String group)
void removeConfig(HelixConfigScope scope, List<String> keys)
Remove configuration values
void removeConstraint(String clusterName, ClusterConstraints.ConstraintType constraintType, String constraintId)
Remove a constraint item
void removeInstanceTag(String clusterName, String instanceName, String tag)
void resetInstance(String clusterName, List<String> instanceNames)
Reset all the partitions in error state for a list of instances
void resetPartition(String clusterName, String instanceName, String resourceName, List<String> partitionNames)
Reset a list of partitions in error state for an instance The partitions are assume to be in error state and reset will bring them from error to initial state.
void resetResource(String clusterName, List<String> resourceNames)
Reset all partitions in error state for a list of resources
void setConfig(HelixConfigScope scope, Map<StringString> properties)
Set configuration values
void setConstraint(String clusterName, ClusterConstraints.ConstraintType constraintType, String constraintId, ConstraintItem constraintItem)
Add a constraint item; create if not exist
void setResourceIdealState(String clusterName, String resourceName, IdealState idealState)
Set ideal state for a resource
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.helix.HelixAdmin

Constants

public static final String CONNECTION_TIMEOUT

Constant Value: "helixAdmin.timeOutInSec"

Public Constructors

public ZKHelixAdmin (ZkClient zkClient)

public ZKHelixAdmin (String zkAddress)

Public Methods

public void addAlert (String clusterName, String alertName)

Add an alert to a cluster

public boolean addCluster (String clusterName, boolean recreateIfExists)

Add a cluster

Parameters
recreateIfExists If the cluster already exists, it will delete it and recreate
Returns
  • true if successfully created, or if cluster already exists

public boolean addCluster (String clusterName)

Add a cluster

Returns
  • true if successfully created, or if cluster already exists

public void addClusterToGrandCluster (String clusterName, String grandCluster)

Add a cluster and also add this cluster as a resource group in the super cluster

public void addIdealState (String clusterName, String resourceName, String idealStateFile)

Add ideal state using a json format file

Throws
IOException

public void addInstance (String clusterName, InstanceConfig instanceConfig)

Add an instance to a cluster

public void addInstanceTag (String clusterName, String instanceName, String tag)

public void addResource (String clusterName, String resourceName, int partitions, String stateModelRef)

Add a resource to a cluster, using the default ideal state mode AUTO

public void addResource (String clusterName, String resourceName, int partitions, String stateModelRef, String rebalancerMode)

Add a resource to a cluster

public void addResource (String clusterName, String resourceName, IdealState idealstate)

public void addResource (String clusterName, String resourceName, int partitions, String stateModelRef, String rebalancerMode, int bucketSize)

Add a resource to a cluster, using a bucket size > 1

public void addResource (String clusterName, String resourceName, int partitions, String stateModelRef, String rebalancerMode, int bucketSize, int maxPartitionsPerInstance)

Add a resource to a cluster, using a bucket size > 1

public void addStat (String clusterName, String statName)

Add a statistics to a cluster

public void addStateModelDef (String clusterName, String stateModelDef, StateModelDefinition stateModel)

Add a state model definition

public void addStateModelDef (String clusterName, String stateModelDefName, String stateModelDefFile)

Add state model definition using a json format file

Throws
IOException

public void close ()

Release resources

public void dropAlert (String clusterName, String alertName)

Drop an alert from a cluster

public void dropCluster (String clusterName)

Drop a cluster

public void dropInstance (String clusterName, InstanceConfig instanceConfig)

Drop an instance from a cluster

public void dropResource (String clusterName, String resourceName)

Drop a resource from a cluster

public void dropStat (String clusterName, String statName)

Drop statistics from a cluster

public void enableCluster (String clusterName, boolean enabled)

Disable or enable a cluster

public void enableInstance (String clusterName, String instanceName, boolean enabled)

Disable or enable an instance

public void enablePartition (boolean enabled, String clusterName, String instanceName, String resourceName, List<String> partitionNames)

Disable or enable a list of partitions on an instance

public List<String> getClusters ()

Get a list of clusters under "/"

Returns
  • a list of cluster names

public Map<StringString> getConfig (HelixConfigScope scope, List<String> keys)

Get configuration values

Returns
  • configuration values ordered by the provided keys

public List<String> getConfigKeys (HelixConfigScope scope)

Get configuration keys

Returns
  • keys mapping to valid configuration values

public ClusterConstraints getConstraints (String clusterName, ClusterConstraints.ConstraintType constraintType)

Get all constraints for a type

Returns
  • constraints of constraintType

public InstanceConfig getInstanceConfig (String clusterName, String instanceName)

Get an instance config

Returns
  • InstanceConfig corresponding to the specified instance

public List<String> getInstancesInCluster (String clusterName)

Get a list of instances under a cluster

Returns
  • a list of instance names

public List<String> getInstancesInClusterWithTag (String clusterName, String tag)

public ExternalView getResourceExternalView (String clusterName, String resourceName)

Get external view for a resource

Returns
  • ExternalView for the resource

public IdealState getResourceIdealState (String clusterName, String resourceName)

Get ideal state for a resource

public List<String> getResourcesInCluster (String clusterName)

Get a list of resources in a cluster

Returns
  • a list of resource names in the cluster

public StateModelDefinition getStateModelDef (String clusterName, String stateModelName)

Get a state model definition in a cluster

Returns
  • StateModelDefinition identified by stateModelName

public List<String> getStateModelDefs (String clusterName)

Get a list of state model definitions in a cluster

public void rebalance (String clusterName, String resourceName, int replica, List<String> instances)

public void rebalance (String clusterName, String resourceName, int replica)

Rebalance a resource in cluster

public void rebalance (String clusterName, IdealState currentIdealState, List<String> instanceNames)

Takes the existing idealstate as input and computes newIdealState such that the partition movement is minimized. The partitions are redistributed among the instances provided.

public void rebalance (String clusterName, String resourceName, int replica, String keyPrefix, String group)

public void removeConfig (HelixConfigScope scope, List<String> keys)

Remove configuration values

public void removeConstraint (String clusterName, ClusterConstraints.ConstraintType constraintType, String constraintId)

Remove a constraint item

public void removeInstanceTag (String clusterName, String instanceName, String tag)

public void resetInstance (String clusterName, List<String> instanceNames)

Reset all the partitions in error state for a list of instances

public void resetPartition (String clusterName, String instanceName, String resourceName, List<String> partitionNames)

Reset a list of partitions in error state for an instance The partitions are assume to be in error state and reset will bring them from error to initial state. An error to initial state transition is required for reset.

public void resetResource (String clusterName, List<String> resourceNames)

Reset all partitions in error state for a list of resources

public void setConfig (HelixConfigScope scope, Map<StringString> properties)

Set configuration values

public void setConstraint (String clusterName, ClusterConstraints.ConstraintType constraintType, String constraintId, ConstraintItem constraintItem)

Add a constraint item; create if not exist

public void setResourceIdealState (String clusterName, String resourceName, IdealState idealState)

Set ideal state for a resource