Skip to content

Customize the configuration of the NebulaGraph cluster

The Meta, Storage, and Graph services each have their default configurations within the NebulaGraph cluster. NebulaGraph Operator allows for the customization of these cluster service configurations. This topic describes how to update the settings of the NebulaGraph cluster.

Note

Configuring the parameters of the NebulaGraph cluster via Helm isn't currently supported.

Prerequisites

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

Configuration method

You can update the configurations of cluster services by customizing parameters through spec.<metad|graphd|storaged>.config. NebulaGraph Operator loads the configurations from config into the corresponding service's ConfigMap, which is then mounted into the service's configuration file directory (/usr/local/nebula/etc/) at the time of the service launch.

The structure of config is as follows:

Config map[string]string `json:"config,omitempty"`

For instance, when updating the Graph service's enable_authorize parameter settings, the spec.graphd.config parameter can be specified at the time of cluster creation, or during cluster runtime.

apiVersion: apps.nebula-graph.io/v1alpha1
kind: NebulaCluster
metadata:
  name: nebula
  namespace: default
spec:
  graphd:
    ...
    config: // Custom-defined parameters for the Graph service.
      "enable_authorize": "true"  // Enable authorization. Default value is false.
...

If you need to configure config for the Meta and Storage services, add corresponding configuration items to spec.metad.config and spec.storaged.config.

Configurable parameters

For more detailed information on the parameters that can be set under the config field, see the following:

Parameter updates & Pod restart rules

Configuration parameters for cluster services fall into two categories: those which require a service restart for any updates; and those which can be dynamically updated during service runtime. For the latter type, the updates will not be saved; subsequent to a service restart, configurations will revert to the state as shown in the configuration file.

Regarding if the configuration parameters support dynamic updates during service runtime, please verify the information within the Whether supports runtime dynamic modifications column on each of the service configuration parameter detail pages linked above or see Dynamic runtime flags.

During the update of cluster service configurations, keep the following points in mind:

  • If the updated parameters under config all allow for dynamic runtime updates, a service Pod restart will not be triggered and the configuration parameter updates will not be saved.
  • If the updated parameters under config include one or more that don’t allow for dynamic runtime updates, a service Pod restart will be triggered, but only updates to those parameters that don’t allow for dynamic updates will be saved.

Note

If you wish to modify the parameter settings during cluster runtime without triggering a Pod restart, make sure that all the parameters support dynamic updates during runtime.

Customize port configuration

The following example demonstrates how to customize the port configurations for the Meta, Storage, and Graph services.

You can add port and ws_http_port parameters to the config field in order to set custom ports. For detailed information regarding these two parameters, see the networking configuration sections at Meta Service Configuration Parameters, Storage Service Configuration Parameters, Graph Service Configuration Parameters.

Note

  • After customizing the port and ws_http_port parameter settings, a Pod restart is triggered and then the updated settings take effect after the restart.
  • Once the cluster is started, it is not recommended to modify the port parameter.
  1. Modify the cluster configuration file.

    1. Open the cluster configuration file.

      kubectl edit nc nebula
      
    2. Modify the configuration file as follows.

      Add the config field to the graphd, metad, and storaged sections to customize the port configurations for the Graph, Meta, and Storage services, respectively.

      apiVersion: apps.nebula-graph.io/v1alpha1
      kind: NebulaCluster
      metadata:
        name: nebula
        namespace: default
      spec:
        graphd:
          config:  // Custom port configuration for the Graph service.
            port: "3669"
            ws_http_port: "8080"
          resources:
            requests:
              cpu: "200m"
              memory: "500Mi"
            limits:
              cpu: "1"
              memory: "1Gi"
          replicas: 1
          image: vesoft/nebula-graphd
          version: v3.5.0
        metad: 
          config:  // Custom port configuration for the Meta service.
            ws_http_port: 8081
          resources:
            requests:
              cpu: "300m"
              memory: "500Mi"
            limits:
              cpu: "1"
              memory: "1Gi"
          replicas: 1
          image: vesoft/nebula-metad
          version: v3.5.0
          dataVolumeClaim:
            resources:
              requests:
                storage: 2Gi
            storageClassName: local-path
        storaged:  
          config:  // Custom port configuration for the Storage service.
            ws_http_port: 8082
          resources:
            requests:
              cpu: "300m"
              memory: "500Mi"
            limits:
              cpu: "1"
              memory: "1Gi"
          replicas: 1
          image: vesoft/nebula-storaged
          version: v3.5.0
          dataVolumeClaims:
          - resources:
              requests:
                storage: 2Gi
            storageClassName: local-path
          enableAutoBalance: true
        reference:
          name: statefulsets.apps
          version: v1
        schedulerName: default-scheduler
        imagePullPolicy: IfNotPresent
        imagePullSecrets:
        - name: nebula-image
        enablePVReclaim: true
        topologySpreadConstraints:
        - topologyKey: kubernetes.io/hostname
          whenUnsatisfiable: "ScheduleAnyway"
      
  2. Save the changes.

    Changes will be saved automatically after saving the file.

    1. Press Esc to enter command mode.
    2. Enter :wq to save and exit.
  3. Validate that the configurations have taken effect.

    kubectl get svc
    

    Example output:

    NAME                        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
    nebula-graphd-headless      ClusterIP   None             <none>        3669/TCP,8080/TCP            10m
    nebula-graphd-svc           ClusterIP   10.102.13.115    <none>        3669/TCP,8080/TCP            10m
    nebula-metad-headless       ClusterIP   None             <none>        9559/TCP,8081/TCP            11m
    nebula-storaged-headless    ClusterIP   None             <none>        9779/TCP,8082/TCP,9778/TCP   11m
    

    As can be noticed, the Graph service's RPC daemon port is changed to 3669 (default 9669), the HTTP port to 8080 (default 19669); the Meta service's HTTP port is changed to 8081 (default 19559); the Storage service's HTTP port is changed to 8082 (default 19779).


Last update: March 6, 2024