Package com.linkedin.venice.controller
Class ZkHelixAdminClient
- java.lang.Object
-
- com.linkedin.venice.controller.ZkHelixAdminClient
-
- All Implemented Interfaces:
HelixAdminClient
public class ZkHelixAdminClient extends java.lang.Object implements HelixAdminClient
The purpose of this class is to abstract Helix operations out of theVeniceHelixAdminand eventually rename it to VeniceAdmin. This is one implementation of theHelixAdminClientinterface which uses Zk based Helix API. In the future we might move to the Helix REST API.
-
-
Constructor Summary
Constructors Constructor Description ZkHelixAdminClient(VeniceControllerMultiClusterConfig multiClusterConfigs, io.tehuti.metrics.MetricsRepository metricsRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClusterToGrandCluster(java.lang.String clusterName)Add the specified cluster as a resource to the grand cluster to be managed by HaaS controllers.voidaddVeniceStorageClusterToControllerCluster(java.lang.String clusterName)Add the given Venice storage cluster's cluster resource to the controller cluster.voidclose()Release resources.booleancontainsResource(java.lang.String clusterName, java.lang.String resourceName)Check if a resource exists in a cluster by checking its ideal state.voidcreateVeniceControllerCluster()Create and configure the Venice controller cluster.voidcreateVeniceStorageCluster(java.lang.String clusterName, java.util.Map<java.lang.String,java.lang.String> helixClusterProperties)Create and configure the Venice storage cluster.voidcreateVeniceStorageClusterResources(java.lang.String clusterName, java.lang.String kafkaTopic, int numberOfPartition, int replicationFactor)Create resources for a given storage node cluster.voiddropResource(java.lang.String clusterName, java.lang.String resourceName)Drop a resource from a cluster.voiddropStorageInstance(java.lang.String clusterName, java.lang.String instanceName)Drop a storage node instance from the given cluster.voidenablePartition(boolean enabled, java.lang.String clusterName, java.lang.String instanceName, java.lang.String resourceName, java.util.List<java.lang.String> partitionNames)Disable or enable a list of partitions on an instance.java.util.Map<java.lang.String,java.util.List<java.lang.String>>getDisabledPartitionsMap(java.lang.String clusterName, java.lang.String instanceName)Returns a list of disabled partitions in an instance.java.util.List<java.lang.String>getInstancesInCluster(java.lang.String clusterName)Get a list of instances under a cluster.booleanisClusterInGrandCluster(java.lang.String clusterName)Check if the grand cluster managed by HaaS controllers is aware of the given cluster.booleanisVeniceControllerClusterCreated()Check if the Venice controller cluster is created and configured.booleanisVeniceStorageClusterCreated(java.lang.String clusterName)Check if the given Venice storage cluster is created and configured.booleanisVeniceStorageClusterInControllerCluster(java.lang.String clusterName)Check if the given Venice storage cluster's cluster resource is in the Venice controller cluster.voidresetPartition(java.lang.String clusterName, java.lang.String instanceName, java.lang.String resourceName, java.util.List<java.lang.String> partitionNames)Reset a list of partitions in error state for an instance.voidsetCloudConfig(java.lang.String clusterName, VeniceControllerClusterConfig config)voidupdateClusterConfigs(java.lang.String clusterName, java.util.Map<java.lang.String,java.lang.String> helixClusterProperties)Update some Helix cluster properties for the given cluster.
-
-
-
Constructor Detail
-
ZkHelixAdminClient
public ZkHelixAdminClient(VeniceControllerMultiClusterConfig multiClusterConfigs, io.tehuti.metrics.MetricsRepository metricsRepository)
-
-
Method Detail
-
isVeniceControllerClusterCreated
public boolean isVeniceControllerClusterCreated()
Description copied from interface:HelixAdminClientCheck if the Venice controller cluster is created and configured.- Specified by:
isVeniceControllerClusterCreatedin interfaceHelixAdminClient- Returns:
- true or false.
- See Also:
HelixAdminClient.isVeniceControllerClusterCreated()
-
isVeniceStorageClusterCreated
public boolean isVeniceStorageClusterCreated(java.lang.String clusterName)
Description copied from interface:HelixAdminClientCheck if the given Venice storage cluster is created and configured.- Specified by:
isVeniceStorageClusterCreatedin interfaceHelixAdminClient- Parameters:
clusterName- of the Venice cluster.- Returns:
- true or false.
- See Also:
HelixAdminClient.isVeniceStorageClusterCreated(String)
-
createVeniceControllerCluster
public void createVeniceControllerCluster()
Description copied from interface:HelixAdminClientCreate and configure the Venice controller cluster.- Specified by:
createVeniceControllerClusterin interfaceHelixAdminClient- See Also:
HelixAdminClient.createVeniceControllerCluster()
-
createVeniceStorageCluster
public void createVeniceStorageCluster(java.lang.String clusterName, java.util.Map<java.lang.String,java.lang.String> helixClusterProperties)Description copied from interface:HelixAdminClientCreate and configure the Venice storage cluster.- Specified by:
createVeniceStorageClusterin interfaceHelixAdminClient- Parameters:
clusterName- of the Venice storage cluster.helixClusterProperties- to be applied to the new cluster.- See Also:
HelixAdminClient.createVeniceStorageCluster(String, Map)
-
isVeniceStorageClusterInControllerCluster
public boolean isVeniceStorageClusterInControllerCluster(java.lang.String clusterName)
Description copied from interface:HelixAdminClientCheck if the given Venice storage cluster's cluster resource is in the Venice controller cluster.- Specified by:
isVeniceStorageClusterInControllerClusterin interfaceHelixAdminClient- Parameters:
clusterName- of the Venice storage cluster.- Returns:
- true or false.
- See Also:
HelixAdminClient.isVeniceStorageClusterInControllerCluster(String)
-
addVeniceStorageClusterToControllerCluster
public void addVeniceStorageClusterToControllerCluster(java.lang.String clusterName)
Description copied from interface:HelixAdminClientAdd the given Venice storage cluster's cluster resource to the controller cluster.- Specified by:
addVeniceStorageClusterToControllerClusterin interfaceHelixAdminClient- Parameters:
clusterName- of the Venice storage cluster.- See Also:
HelixAdminClient.addVeniceStorageClusterToControllerCluster(String)
-
isClusterInGrandCluster
public boolean isClusterInGrandCluster(java.lang.String clusterName)
Description copied from interface:HelixAdminClientCheck if the grand cluster managed by HaaS controllers is aware of the given cluster.- Specified by:
isClusterInGrandClusterin interfaceHelixAdminClient- Parameters:
clusterName- of the cluster.- Returns:
- true or false.
- See Also:
HelixAdminClient.isClusterInGrandCluster(String)
-
addClusterToGrandCluster
public void addClusterToGrandCluster(java.lang.String clusterName)
Description copied from interface:HelixAdminClientAdd the specified cluster as a resource to the grand cluster to be managed by HaaS controllers.- Specified by:
addClusterToGrandClusterin interfaceHelixAdminClient- Parameters:
clusterName- of the cluster to be added as a resource to the grand cluster.- See Also:
HelixAdminClient.addClusterToGrandCluster(String)
-
updateClusterConfigs
public void updateClusterConfigs(java.lang.String clusterName, java.util.Map<java.lang.String,java.lang.String> helixClusterProperties)Description copied from interface:HelixAdminClientUpdate some Helix cluster properties for the given cluster.- Specified by:
updateClusterConfigsin interfaceHelixAdminClient- Parameters:
clusterName- of the cluster to be updated.helixClusterProperties- to be applied to the given cluster.- See Also:
HelixAdminClient.updateClusterConfigs(String, Map)
-
enablePartition
public void enablePartition(boolean enabled, java.lang.String clusterName, java.lang.String instanceName, java.lang.String resourceName, java.util.List<java.lang.String> partitionNames)Description copied from interface:HelixAdminClientDisable or enable a list of partitions on an instance.- Specified by:
enablePartitionin interfaceHelixAdminClient- See Also:
HelixAdminClient.enablePartition(boolean, String, String, String, List)
-
getInstancesInCluster
public java.util.List<java.lang.String> getInstancesInCluster(java.lang.String clusterName)
Description copied from interface:HelixAdminClientGet a list of instances under a cluster.- Specified by:
getInstancesInClusterin interfaceHelixAdminClient- Returns:
- a list of instance names.
- See Also:
HelixAdminClient.getInstancesInCluster(String)
-
createVeniceStorageClusterResources
public void createVeniceStorageClusterResources(java.lang.String clusterName, java.lang.String kafkaTopic, int numberOfPartition, int replicationFactor)Description copied from interface:HelixAdminClientCreate resources for a given storage node cluster.- Specified by:
createVeniceStorageClusterResourcesin interfaceHelixAdminClient- See Also:
HelixAdminClient.createVeniceStorageClusterResources(String, String, int, int)
-
containsResource
public boolean containsResource(java.lang.String clusterName, java.lang.String resourceName)Description copied from interface:HelixAdminClientCheck if a resource exists in a cluster by checking its ideal state.- Specified by:
containsResourcein interfaceHelixAdminClient
-
dropResource
public void dropResource(java.lang.String clusterName, java.lang.String resourceName)Description copied from interface:HelixAdminClientDrop a resource from a cluster.- Specified by:
dropResourcein interfaceHelixAdminClient- See Also:
HelixAdminClient.dropResource(String, String)
-
dropStorageInstance
public void dropStorageInstance(java.lang.String clusterName, java.lang.String instanceName)Description copied from interface:HelixAdminClientDrop a storage node instance from the given cluster.- Specified by:
dropStorageInstancein interfaceHelixAdminClient- See Also:
HelixAdminClient.dropStorageInstance(String, String)
-
getDisabledPartitionsMap
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getDisabledPartitionsMap(java.lang.String clusterName, java.lang.String instanceName)Description copied from interface:HelixAdminClientReturns a list of disabled partitions in an instance.- Specified by:
getDisabledPartitionsMapin interfaceHelixAdminClient
-
resetPartition
public void resetPartition(java.lang.String clusterName, java.lang.String instanceName, java.lang.String resourceName, java.util.List<java.lang.String> partitionNames)Description copied from interface:HelixAdminClientReset a list of partitions in error state for an instance.The partitions are assumed 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.
- Specified by:
resetPartitionin interfaceHelixAdminClient- See Also:
HelixAdminClient.resetPartition(String, String, String, List)
-
close
public void close()
Description copied from interface:HelixAdminClientRelease resources.- Specified by:
closein interfaceHelixAdminClient- See Also:
HelixAdminClient.close()
-
setCloudConfig
public void setCloudConfig(java.lang.String clusterName, VeniceControllerClusterConfig config)
-
-