Scaling subclusters
The operator enables you to scale the number of subclusters, and the number of pods per subcluster automatically. This allows you to utilize or conserve resources depending on the immediate needs of your workload.
The following sections explain how to scale resources for new workloads. For details about scaling resources for existing workloads, see VerticaAutoscaler custom resource.
Prerequisites
-
Complete Installing the Vertica DB operator.
-
Install the kubectl command line tool.
-
Complete Creating a custom resource.
-
Confirm that you have the resources to scale.
Note
By default, the custom resource uses the free Community Edition (CE) license. This license allows you to deploy up to three nodes with a maximum of 1TB of data. To add resources beyond these limits, you must add your Vertica license to the custom resource as described in Creating a custom resource.
Scaling the number of subclusters
Adjust the number of subclusters in your custom resource to fine-tune resources for short-running dashboard queries. For example, increase the number of subclusters to increase throughput. For more information, see Improving query throughput using subclusters.
-
Use
kubectl edit
to open your default text editor and update the YAML file for the specified custom resource. The following command opens a custom resource namedvdb
for editing:$ kubectl edit vdb
-
In the
spec
section of the custom resource, locate thesubclusters
subsection. Begin theisPrimary
field to define a new subcluster.The
isPrimary
field accepts a boolean that specifies whether the subcluster is a primary or secondary. Because there is already a primary subcluster in our custom resource, enterfalse
:spec: ... subclusters: ... - isPrimary: false
-
Follow the steps in Creating a custom resource to complete the subcluster definition. The following completed example adds a secondary subcluster for dashboard queries:
spec: ... subclusters: - isPrimary: true name: primary-subcluster ... - isPrimary: false name: dashboard nodePort: 32001 resources: limits: cpu: 32 memory: 96Gi requests: cpu: 32 memory: 96Gi serviceType: NodePort size: 3
-
Save and close the custom resource file. You receive a message similar to the following when you successfully update the file:
verticadb.vertica.com/vertica-db edited
-
Use the
kubectl wait
command to monitor when the new pods are ready:$ kubectl wait --for=condition=Ready pod --selector app.kubernetes.io/name=vertica-db --timeout 180s pod/vdb-dashboard-0 condition met pod/vdb-dashboard-1 condition met pod/vdb-dashboard-2 condition met
Scaling the pods in a subcluster
For long-running, analytic queries, increase the pod count for a subcluster. See Using elastic crunch scaling to improve query performance.
-
Use
kubectl edit
to open your default text editor and update the YAML file for the specified custom resource. The following command opens a custom resource namedvdb
for editing:$ kubectl edit vertica-db
-
Update the
subclusters.size
value to 6:spec: ... subclusters: ... - isPrimary: false ... size: 6
Shards are rebalanced automatically.
-
Save and close the custom resource file. You receive a message similar to the following when you successfully update the file:
verticadb.vertica.com/vertica-db edited
-
Use the
kubectl wait
command to monitor when the new pods are ready:$ kubectl wait --for=condition=Ready pod --selector app.kubernetes.io/name=vertica-db --timeout 180s pod/vdb-subcluster1-3 condition met pod/vdb-subcluster1-4 condition met pod/vdb-subcluster1-5 condition met
Removing a subcluster
Remove a subcluster when it is no longer needed, or to preserve resources.
Important
Because each custom resource instance requires a primary subcluster, you cannot remove all subclusters.-
Use
kubectl edit
to open your default text editor and update the YAML file for the specified custom resource. The following command opens a custom resource namedvdb
for editing:$ kubectl edit vertica-db
-
In the
subclusters
subsection nested underspec
, locate the subcluster that you want to delete. Delete the element in the subcluster array represents the subcluster that you want to delete. Each element is identified by a hyphen (-). -
After you delete the subcluster and save, you receive a message similar to the following:
verticadb.vertica.com/vertica-db edited