Skip to content

Scale a NebulaGraph Cluster

This topic describes how to scale the number of service replicas in your NebulaGraph cluster.

Prerequisites

A cluster is established using NebulaGraph Operator. For details, see Create a NebulaGraph cluster.

Limitations

Scaling the NebulaGraph cluster is only supported by NebulaGraph Operator v1.1.0 and above.

Scale clusters with kubectl

You can scale the NebulaGraph cluster services by editing the replicas value in the cluster configuration file.

Scale out clusters

As an example, let's scale out the Storage service in the NebulaGraph cluster to 5 replicas:

  1. View the list of clusters.

    kubectl get nc --all-namespaces
    

    Example output:

    NAMESPACE   NAME      READY   GRAPHD-DESIRED   GRAPHD-READY   METAD-DESIRED   METAD-READY   STORAGED-DESIRED   STORAGED-READY   AGE
    nebula      nebula    True    1                1              1               1             3                  3                4d23h
    ...
    
  2. Change the spec.storaged.replicas parameter value from 3 to 5 in the configuration file of the cluster named nebula.

    kubectl patch nc nebula -n nebula --type='merge' --patch '{"spec": {"storaged": {"replicas":5}}}'
    

    Example output:

    nebulacluster.apps.nebula-graph.io/nebula patched
    
  3. Check the number of Storage service replicas after the scale-out.

    kubectl get pods -l app.kubernetes.io/cluster=nebula
    

    Example output:

    NAME                READY   STATUS    RESTARTS   AGE
    nebula-graphd-0     1/1     Running   0          2m
    nebula-metad-0      1/1     Running   0          2m
    nebula-storaged-0   1/1     Running   0          2m
    nebula-storaged-1   1/1     Running   0          2m
    nebula-storaged-2   1/1     Running   0          2m
    nebula-storaged-3   1/1     Running   0          5m
    nebula-storaged-4   1/1     Running   0          5m
    

Scale in clusters

Scaling in the cluster follows the same principle as scaling out: just decrease the replicas value in the cluster configuration file. For details, see the Scale out clusters section above.

If the scale-in operation remains incomplete for a long time, you can go to the console container started through the spec.console field and check the status of the scale-in job. If the scale-in Job status is FAILED, you can check the Meta service's log to find the cause of the scale-in failure. For more information about Jobs, please see Job Management.

Caution

  • Scaling is supported only for the Graph and Storage services in the NebulaGraph cluster, but not for the Meta service.
  • If the cluster with the zone feature is scaled in, it is necessary to ensure that the remaining number of Storage Pods after scaling in is not less than the number of zones specified by spec.metad.config.zone_list. For example, if the number of zones is 3, then the number of Storage Pods after scaling down cannot be less than 3. For more information about zones, please see Zone.

Scale clusters with helm

The cluster can be scaled by modifying the replicas values for different services within NebulaGraph.

Scale out clusters

  1. Check the default configuration of the Helm release.

    helm show values nebula-operator/nebula-cluster -n default
    

    Result:

    nebula:
    version: v3.5.0
    ...
    storaged:
      replicas: 2
    
  2. Scale out the Storage service of the NebulaGraph cluster to 5 replicas with the following command:

    helm upgrade nebula nebula-operator/nebula-cluster \
        --namespace="default" \
        --set nebula.storaged.replicas=5
    

Scale in clusters

The principle of scaling in a cluster is the same as scaling out a cluster. Simply set the replicas value of the services in the NebulaGraph cluster to be less than the original.

If the scale-in operation remains incomplete for a long time, you can go to the console container started through nebula.console field and check the state of scale-in Jobs. If the scale-in Job status is FAILED, you can check the Meta service's log to find out why the scale-in failed. For more information about Jobs, see Job Management.

Caution

  • Scaling is supported only for the Graph and Storage services in the NebulaGraph cluster, but not for the Meta service.
  • If the cluster with the zone feature enabled is scaled in, ensure that the remaining number of Storage Pods after the scaled-in is no less than the number of zones specified by nebula.metad.config.zone_list. For instance, if the number of zones is 3, then the number of Storage Pods after the scale-in cannot be less than 3. For more information about zones, see Enable zones.

Last update: March 7, 2024