public class

ClusterSetup

extends Object
java.lang.Object
   ↳ org.apache.helix.tools.ClusterSetup

Summary

Constants
String activateCluster
String addAlert
String addCluster
String addIdealState
String addInstance
String addInstanceTag
String addResource
String addResourceProperty
String addStat
String addStateModelDef
String bucketSize
String dropAlert
String dropCluster
String dropInstance
String dropResource
String dropStat
String enableCluster
String enableInstance
String enablePartition
String expandCluster
String expandResource
String getConfig
String getConstraints
String help
String instanceGroupTag
String listClusterInfo
String listClusters
String listInstanceInfo
String listInstances
String listPartitionInfo
String listResourceInfo
String listResources
String listStateModel
String listStateModels
String maxPartitionsPerNode
String mode
String rebalance
String removeConfig
String removeConstraint
String removeInstanceTag
String removeResourceProperty
String resetInstance
String resetPartition
String resetResource
String resourceKeyPrefix
String setConfig
String setConstraint
String swapInstance
String zkServerAddress
Public Constructors
ClusterSetup(String zkServerAddress)
ClusterSetup(ZkClient zkClient)
Public Methods
void activateCluster(String clusterName, String grandCluster, boolean enable)
void addCluster(String clusterName, boolean overwritePrevious)
void addIdealState(String clusterName, String resourceName, String idealStateFile)
void addInstanceToCluster(String clusterName, String instanceId)
void addInstancesToCluster(String clusterName, String[] instanceInfoArray)
void addResourceProperty(String clusterName, String resourceName, String propertyKey, String propertyVal)
void addResourceToCluster(String clusterName, String resourceName, int numResources, String stateModelRef, String rebalancerMode)
void addResourceToCluster(String clusterName, String resourceName, int numResources, String stateModelRef, String rebalancerMode, int bucketSize)
void addResourceToCluster(String clusterName, String resourceName, int numResources, String stateModelRef, String rebalancerMode, int bucketSize, int maxPartitionsPerInstance)
void addResourceToCluster(String clusterName, String resourceName, int numResources, String stateModelRef)
void addStateModelDef(String clusterName, String stateModelDef, StateModelDefinition record)
void balanceIdealState(String clusterName, IdealState idealState)
void deleteCluster(String clusterName)
void dropInstanceFromCluster(String clusterName, String instanceId)
void dropInstancesFromCluster(String clusterName, String[] instanceInfoArray)
void dropResourceFromCluster(String clusterName, String resourceName)
void expandCluster(String clusterName)
void expandResource(String clusterName, String resourceName)
HelixAdmin getClusterManagementTool()
String getConfig(HelixConfigScope.ConfigScopeProperty type, String scopeArgsCsv, String keysCsv)
get configs
String getConstraints(String clusterName, String constraintType)
get constraints associated with given type
static void main(String[] args)
static void printUsage(Options cliOptions)
static int processCommandLineArgs(String[] cliArgs)
void rebalanceCluster(String clusterName, String resourceName, int replica, String keyPrefix, String group)
void rebalanceResource(String clusterName, String resourceName, int replica)
void rebalanceStorageCluster(String clusterName, String resourceName, int replica)
void rebalanceStorageCluster(String clusterName, String resourceName, String group, int replica)
void rebalanceStorageCluster(String clusterName, String resourceName, int replica, String keyPrefix)
void removeConfig(HelixConfigScope.ConfigScopeProperty type, String scopeArgsCsv, String keysCsv)
remove configs
void removeConstraint(String clusterName, String constraintType, String constraintId)
remove constraint
void removeResourceProperty(String clusterName, String resourceName, String propertyKey)
void setConfig(HelixConfigScope.ConfigScopeProperty type, String scopeArgsCsv, String keyValuePairs)
set configs
void setConstraint(String clusterName, String constraintType, String constraintId, String constraintAttributesMap)
set constraint
void setupTestCluster(String clusterName)
Sets up a cluster
6 Instances[localhost:8900 to localhost:8905],
1 resource[TestDB] with a replication factor of 3 and using MasterSlave state model
void swapInstance(String clusterName, String oldInstanceName, String newInstanceName)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String activateCluster

Constant Value: "activateCluster"

public static final String addAlert

Constant Value: "addAlert"

public static final String addCluster

Constant Value: "addCluster"

public static final String addIdealState

Constant Value: "addIdealState"

public static final String addInstance

Constant Value: "addNode"

public static final String addInstanceTag

Constant Value: "addInstanceTag"

public static final String addResource

Constant Value: "addResource"

public static final String addResourceProperty

Constant Value: "addResourceProperty"

public static final String addStat

Constant Value: "addStat"

public static final String addStateModelDef

Constant Value: "addStateModelDef"

public static final String bucketSize

Constant Value: "bucketSize"

public static final String dropAlert

Constant Value: "dropAlert"

public static final String dropCluster

Constant Value: "dropCluster"

public static final String dropInstance

Constant Value: "dropNode"

public static final String dropResource

Constant Value: "dropResource"

public static final String dropStat

Constant Value: "dropStat"

public static final String enableCluster

Constant Value: "enableCluster"

public static final String enableInstance

Constant Value: "enableInstance"

public static final String enablePartition

Constant Value: "enablePartition"

public static final String expandCluster

Constant Value: "expandCluster"

public static final String expandResource

Constant Value: "expandResource"

public static final String getConfig

Constant Value: "getConfig"

public static final String getConstraints

Constant Value: "getConstraints"

public static final String help

Constant Value: "help"

public static final String instanceGroupTag

Constant Value: "instanceGroupTag"

public static final String listClusterInfo

Constant Value: "listClusterInfo"

public static final String listClusters

Constant Value: "listClusters"

public static final String listInstanceInfo

Constant Value: "listInstanceInfo"

public static final String listInstances

Constant Value: "listInstances"

public static final String listPartitionInfo

Constant Value: "listPartitionInfo"

public static final String listResourceInfo

Constant Value: "listResourceInfo"

public static final String listResources

Constant Value: "listResources"

public static final String listStateModel

Constant Value: "listStateModel"

public static final String listStateModels

Constant Value: "listStateModels"

public static final String maxPartitionsPerNode

Constant Value: "maxPartitionsPerNode"

public static final String mode

Constant Value: "mode"

public static final String rebalance

Constant Value: "rebalance"

public static final String removeConfig

Constant Value: "removeConfig"

public static final String removeConstraint

Constant Value: "removeConstraint"

public static final String removeInstanceTag

Constant Value: "removeInstanceTag"

public static final String removeResourceProperty

Constant Value: "removeResourceProperty"

public static final String resetInstance

Constant Value: "resetInstance"

public static final String resetPartition

Constant Value: "resetPartition"

public static final String resetResource

Constant Value: "resetResource"

public static final String resourceKeyPrefix

Constant Value: "key"

public static final String setConfig

Constant Value: "setConfig"

public static final String setConstraint

Constant Value: "setConstraint"

public static final String swapInstance

Constant Value: "swapInstance"

public static final String zkServerAddress

Constant Value: "zkSvr"

Public Constructors

public ClusterSetup (String zkServerAddress)

public ClusterSetup (ZkClient zkClient)

Public Methods

public void activateCluster (String clusterName, String grandCluster, boolean enable)

public void addCluster (String clusterName, boolean overwritePrevious)

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

Throws
IOException

public void addInstanceToCluster (String clusterName, String instanceId)

public void addInstancesToCluster (String clusterName, String[] instanceInfoArray)

public void addResourceProperty (String clusterName, String resourceName, String propertyKey, String propertyVal)

public void addResourceToCluster (String clusterName, String resourceName, int numResources, String stateModelRef, String rebalancerMode)

public void addResourceToCluster (String clusterName, String resourceName, int numResources, String stateModelRef, String rebalancerMode, int bucketSize)

public void addResourceToCluster (String clusterName, String resourceName, int numResources, String stateModelRef, String rebalancerMode, int bucketSize, int maxPartitionsPerInstance)

public void addResourceToCluster (String clusterName, String resourceName, int numResources, String stateModelRef)

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

public void balanceIdealState (String clusterName, IdealState idealState)

public void deleteCluster (String clusterName)

public void dropInstanceFromCluster (String clusterName, String instanceId)

public void dropInstancesFromCluster (String clusterName, String[] instanceInfoArray)

public void dropResourceFromCluster (String clusterName, String resourceName)

public void expandCluster (String clusterName)

public void expandResource (String clusterName, String resourceName)

public HelixAdmin getClusterManagementTool ()

public String getConfig (HelixConfigScope.ConfigScopeProperty type, String scopeArgsCsv, String keysCsv)

get configs

Parameters
type config-scope-type, e.g. CLUSTER, RESOURCE, etc.
scopeArgsCsv csv-formatted scope-args, e.g myCluster,testDB
keysCsv csv-formatted keys. e.g. k1,k2
Returns
  • json-formated key-value pairs, e.g. {k1=v1,k2=v2}

public String getConstraints (String clusterName, String constraintType)

get constraints associated with given type

Parameters
constraintType : constraint-type. e.g. MESSAGE_CONSTRAINT
Returns
  • json-formated constraints

public static void main (String[] args)

Throws
Exception

public static void printUsage (Options cliOptions)

public static int processCommandLineArgs (String[] cliArgs)

Throws
Exception

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

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

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

public void rebalanceStorageCluster (String clusterName, String resourceName, String group, int replica)

public void rebalanceStorageCluster (String clusterName, String resourceName, int replica, String keyPrefix)

public void removeConfig (HelixConfigScope.ConfigScopeProperty type, String scopeArgsCsv, String keysCsv)

remove configs

Parameters
type config-scope type, e.g. CLUSTER, RESOURCE, etc.
keysCsv csv-formatted keys. e.g. k1,k2

public void removeConstraint (String clusterName, String constraintType, String constraintId)

remove constraint

public void removeResourceProperty (String clusterName, String resourceName, String propertyKey)

public void setConfig (HelixConfigScope.ConfigScopeProperty type, String scopeArgsCsv, String keyValuePairs)

set configs

Parameters
type config-scope type, e.g. CLUSTER, RESOURCE, etc.
keyValuePairs csv-formatted key-value pairs. e.g. k1=v1,k2=v2

public void setConstraint (String clusterName, String constraintType, String constraintId, String constraintAttributesMap)

set constraint

Parameters
constraintAttributesMap : csv-formated constraint key-value pairs

public void setupTestCluster (String clusterName)

Sets up a cluster
6 Instances[localhost:8900 to localhost:8905],
1 resource[TestDB] with a replication factor of 3 and using MasterSlave state model

public void swapInstance (String clusterName, String oldInstanceName, String newInstanceName)