使用Kubectl部署Nebula Graph集群
本文以创建名为的集群为例,说明如何部署Nebula Graph集群。
创建名为
apps_v1alpha1_nebulacluster.yaml
的文件。示例文件的内容如下:
参数描述如下:
创建Nebula Graph集群。
kubectl create -f apps_v1alpha1_nebulacluster.yaml
返回:
nebulacluster.apps.nebula-graph.io/nebula created
-
返回:
NAME GRAPHD-DESIRED GRAPHD-READY METAD-DESIRED METAD-READY STORAGED-DESIRED STORAGED-READY AGE
用户可以通过编辑apps_v1alpha1_nebulacluster.yaml
文件中的replicas
的值进行Nebula Graph集群的扩缩容。
本文举例扩容Nebula Graph集群中Storage服务至5个。步骤如下:
将
apps_v1alpha1_nebulacluster.yaml
文件中storaged.replicas
的参数值从3
改为5
。storaged:
resources:
requests:
cpu: "1"
limits:
cpu: "1"
memory: "1Gi"
replicas: 5
image: vesoft/nebula-storaged
version: v2.5.1
storageClaim:
requests:
storage: 2Gi
storageClassName: fast-disks
执行以下命令使上述更新同步至Nebula Graph集群CR中。
查看Storage服务的副本数。
kubectl get pods -l app.kubernetes.io/cluster=nebula
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
由上可看出Storage服务的副本数被扩容至5个。
缩容集群
缩容集群的原理和扩容一样,用户只需将文件中的replicas
的值缩小。具体操作,请参考上文的扩容集群部分。
Caution
目前仅支持对Nebula Graph集群中的Graph服务和Storage服务进行扩缩容,不支持扩缩容Meta服务。
使用Kubectl删除Nebula Graph集群的命令如下: