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
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, org.apache.helix.model.ClusterConfig helixClusterConfig, org.apache.helix.model.RESTConfig restConfig)
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
manuallyEnableMaintenanceMode(java.lang.String clusterName, boolean enabled, java.lang.String reason, java.util.Map<java.lang.String,java.lang.String> customFields)
Manually enable maintenance mode.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
updateClusterConfigs(java.lang.String clusterName, org.apache.helix.model.ClusterConfig clusterConfig)
Update some Helix cluster properties for the given cluster.void
updateRESTConfigs(java.lang.String clusterName, org.apache.helix.model.RESTConfig restConfig)
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, org.apache.helix.model.ClusterConfig helixClusterConfig, org.apache.helix.model.RESTConfig restConfig)
Description copied from interface:HelixAdminClient
Create and configure the Venice storage cluster.- Specified by:
createVeniceStorageCluster
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the Venice storage cluster.helixClusterConfig
-ClusterConfig
for the new cluster.restConfig
-RESTConfig
for the new cluster.- See Also:
HelixAdminClient.createVeniceStorageCluster(String, ClusterConfig, RESTConfig)
-
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, org.apache.helix.model.ClusterConfig clusterConfig)
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.clusterConfig
-ClusterConfig
for the new cluster.- See Also:
HelixAdminClient.updateClusterConfigs(String, ClusterConfig)
-
updateRESTConfigs
public void updateRESTConfigs(java.lang.String clusterName, org.apache.helix.model.RESTConfig restConfig)
Description copied from interface:HelixAdminClient
Update some Helix cluster properties for the given cluster.- Specified by:
updateRESTConfigs
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the cluster to be updated.restConfig
-RESTConfig
for the new cluster.- See Also:
HelixAdminClient.updateRESTConfigs(String, RESTConfig)
-
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()
-
manuallyEnableMaintenanceMode
public void manuallyEnableMaintenanceMode(java.lang.String clusterName, boolean enabled, java.lang.String reason, java.util.Map<java.lang.String,java.lang.String> customFields)
Description copied from interface:HelixAdminClient
Manually enable maintenance mode. To be called by the REST client that accepts KV mappings as the payload.- Specified by:
manuallyEnableMaintenanceMode
in interfaceHelixAdminClient
- See Also:
HelixAdminClient#manuallyEnableMaintenanceMode(String, boolean, String, Map
)
-
-