Customize parameters for a NebulaGraph cluster¶
Meta, Storage, and Graph services in a NebulaGraph cluster have their own configuration settings, which are defined in the YAML file of the NebulaGraph cluster instance as config
. These settings are mapped and loaded into the corresponding service's ConfigMap in Kubernetes. At the time of startup, the configuration present in the ConfigMap is mounted onto the directory /usr/local/nebula/etc/
for every service.
Note
It is not available to customize configuration parameters for NebulaGraph Clusters deployed with Helm.
The structure of config
is as follows.
Config map[string]string `json:"config,omitempty"`
Prerequisites¶
You have created a NebulaGraph cluster. For how to create a cluster with Kubectl, see Create a cluster with Kubectl.
Steps¶
The following example uses a cluster named nebula
and the cluster's configuration file named nebula_cluster.yaml
to show how to set config
for the Graph service in a NebulaGraph cluster.
-
Run the following command to access the edit page of the
nebula
cluster.kubectl edit nebulaclusters.apps.nebula-graph.io nebula
-
Customize parameters under the
spec.graphd.config
field. In the following sample, theenable_authorize
andauth_type
parameters are used for demonstration purposes.apiVersion: apps.nebula-graph.io/v1alpha1 kind: NebulaCluster metadata: name: nebula namespace: default spec: graphd: resources: requests: cpu: "500m" memory: "500Mi" limits: cpu: "1" memory: "1Gi" replicas: 1 image: vesoft/nebula-graphd version: master storageClaim: resources: requests: storage: 2Gi storageClassName: fast-disks config: // Custom configuration parameters for the Graph service in a cluster. "enable_authorize": "true" "auth_type": "password" ...
The parameters that can be added under the
config
field are listed in detail in the Meta service configuration parameters, Storage service configuration parameters, and Graph service configuration parameters topics.Note
- To update cluster configurations without incurring pod restart, ensure that all parameters added under the
config
field support runtime dynamic modification. Check the Whether supports runtime dynamic modifications column of the parameter tables on the aforementioned parameter details pages to see if a parameter supports runtime dynamic modification. - If one or more parameters that do not support runtime dynamic modification are added under the
config
field, pod restart is required for the parameters to take effect.
To add the
config
for the Meta and Storage services, addspec.metad.config
andspec.storaged.config
respectively. - To update cluster configurations without incurring pod restart, ensure that all parameters added under the
-
Run
kubectl apply -f nebula_cluster.yaml
to push your configuration changes to the cluster.After customizing the parameters, the configurations in the corresponding ConfigMap (
nebula-graphd
) of the Graph service will be overwritten.
Customize port configurations¶
You can add the port
and ws_http_port
parameters under the config
field to customize port configurations. For details about these two parameters, see the Networking configurations section in Meta service configuration parameters, Storage service configuration parameters, and Graph service configuration parameters.
Note
- Pod restart is required for the
port
andws_http_port
parameters to take effect. - It is NOT recommnended to modify the
port
parameter after the cluster is started.
-
Modifiy the cluster configuration file.
apiVersion: apps.nebula-graph.io/v1alpha1 kind: NebulaCluster metadata: name: nebula namespace: default spec: graphd: config: port: "3669" ws_http_port: "8080" resources: requests: cpu: "200m" memory: "500Mi" limits: cpu: "1" memory: "1Gi" replicas: 1 image: vesoft/nebula-graphd version: master metad: config: ws_http_port: 8081 resources: requests: cpu: "300m" memory: "500Mi" limits: cpu: "1" memory: "1Gi" replicas: 1 image: vesoft/nebula-metad version: master dataVolumeClaim: resources: requests: storage: 2Gi storageClassName: local-path storaged: config: ws_http_port: 8082 resources: requests: cpu: "300m" memory: "500Mi" limits: cpu: "1" memory: "1Gi" replicas: 1 image: vesoft/nebula-storaged version: master 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"
-
Run the
kubectl apply -f nebula_cluster.yaml
to push your configuration changes to the cluster. -
Verify that the configuration takes effect.
kubectl get svc
Sample response:
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