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 theVeniceHelixAdmin
and eventually rename it to VeniceAdmin. This is one implementation of theHelixAdminClient
interface 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 void
addClusterToGrandCluster(java.lang.String clusterName)
Add the specified cluster as a resource to the grand cluster to be managed by HaaS controllers.void
addInstanceTag(java.lang.String clusterName, java.lang.String instanceName, java.lang.String tag)
Adds a tag to an instancevoid
addVeniceStorageClusterToControllerCluster(java.lang.String clusterName)
Add the given Venice storage cluster's cluster resource to the controller cluster.void
close()
Release resources.boolean
containsResource(java.lang.String clusterName, java.lang.String resourceName)
Check if a resource exists in a cluster by checking its ideal state.void
createVeniceControllerCluster()
Create and configure the Venice controller cluster.void
createVeniceStorageCluster(java.lang.String clusterName, java.util.Map<java.lang.String,java.lang.String> helixClusterProperties)
Create and configure the Venice storage cluster.void
createVeniceStorageClusterResources(java.lang.String clusterName, java.lang.String kafkaTopic, int numberOfPartition, int replicationFactor)
Create resources for a given storage node cluster.void
dropResource(java.lang.String clusterName, java.lang.String resourceName)
Drop a resource from a cluster.void
dropStorageInstance(java.lang.String clusterName, java.lang.String instanceName)
Drop a storage node instance from the given cluster.void
enablePartition(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.boolean
isClusterInGrandCluster(java.lang.String clusterName)
Check if the grand cluster managed by HaaS controllers is aware of the given cluster.boolean
isVeniceControllerClusterCreated()
Check if the Venice controller cluster is created and configured.boolean
isVeniceStorageClusterCreated(java.lang.String clusterName)
Check if the given Venice storage cluster is created and configured.boolean
isVeniceStorageClusterInControllerCluster(java.lang.String clusterName)
Check if the given Venice storage cluster's cluster resource is in the Venice controller cluster.void
resetPartition(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.void
setCloudConfig(java.lang.String clusterName, VeniceControllerClusterConfig config)
void
updateClusterConfigs(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:HelixAdminClient
Check if the Venice controller cluster is created and configured.- Specified by:
isVeniceControllerClusterCreated
in interfaceHelixAdminClient
- Returns:
- true or false.
- See Also:
HelixAdminClient.isVeniceControllerClusterCreated()
-
isVeniceStorageClusterCreated
public boolean isVeniceStorageClusterCreated(java.lang.String clusterName)
Description copied from interface:HelixAdminClient
Check if the given Venice storage cluster is created and configured.- Specified by:
isVeniceStorageClusterCreated
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the Venice cluster.- Returns:
- true or false.
- See Also:
HelixAdminClient.isVeniceStorageClusterCreated(String)
-
createVeniceControllerCluster
public void createVeniceControllerCluster()
Description copied from interface:HelixAdminClient
Create and configure the Venice controller cluster.- Specified by:
createVeniceControllerCluster
in 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:HelixAdminClient
Create and configure the Venice storage cluster.- Specified by:
createVeniceStorageCluster
in 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:HelixAdminClient
Check if the given Venice storage cluster's cluster resource is in the Venice controller cluster.- Specified by:
isVeniceStorageClusterInControllerCluster
in 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:HelixAdminClient
Add the given Venice storage cluster's cluster resource to the controller cluster.- Specified by:
addVeniceStorageClusterToControllerCluster
in 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:HelixAdminClient
Check if the grand cluster managed by HaaS controllers is aware of the given cluster.- Specified by:
isClusterInGrandCluster
in 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:HelixAdminClient
Add the specified cluster as a resource to the grand cluster to be managed by HaaS controllers.- Specified by:
addClusterToGrandCluster
in 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:HelixAdminClient
Update some Helix cluster properties for the given cluster.- Specified by:
updateClusterConfigs
in 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:HelixAdminClient
Disable or enable a list of partitions on an instance.- Specified by:
enablePartition
in 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:HelixAdminClient
Get a list of instances under a cluster.- Specified by:
getInstancesInCluster
in 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:HelixAdminClient
Create resources for a given storage node cluster.- Specified by:
createVeniceStorageClusterResources
in 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:HelixAdminClient
Check if a resource exists in a cluster by checking its ideal state.- Specified by:
containsResource
in interfaceHelixAdminClient
-
dropResource
public void dropResource(java.lang.String clusterName, java.lang.String resourceName)
Description copied from interface:HelixAdminClient
Drop a resource from a cluster.- Specified by:
dropResource
in interfaceHelixAdminClient
- See Also:
HelixAdminClient.dropResource(String, String)
-
dropStorageInstance
public void dropStorageInstance(java.lang.String clusterName, java.lang.String instanceName)
Description copied from interface:HelixAdminClient
Drop a storage node instance from the given cluster.- Specified by:
dropStorageInstance
in 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:HelixAdminClient
Returns a list of disabled partitions in an instance.- Specified by:
getDisabledPartitionsMap
in 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:HelixAdminClient
Reset 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:
resetPartition
in interfaceHelixAdminClient
- See Also:
HelixAdminClient.resetPartition(String, String, String, List)
-
close
public void close()
Description copied from interface:HelixAdminClient
Release resources.- Specified by:
close
in interfaceHelixAdminClient
- See Also:
HelixAdminClient.close()
-
addInstanceTag
public void addInstanceTag(java.lang.String clusterName, java.lang.String instanceName, java.lang.String tag)
Description copied from interface:HelixAdminClient
Adds a tag to an instance- Specified by:
addInstanceTag
in interfaceHelixAdminClient
-
setCloudConfig
public void setCloudConfig(java.lang.String clusterName, VeniceControllerClusterConfig config)
-
-