使用Kubectl部署Nebula Graph集群

    本文以创建名为的集群为例,说明如何部署Nebula Graph集群。

    1. 创建名为apps_v1alpha1_nebulacluster.yaml的文件。

      示例文件的内容如下:

      参数描述如下:

    2. 创建Nebula Graph集群。

      1. kubectl create -f apps_v1alpha1_nebulacluster.yaml

      返回:

      1. nebulacluster.apps.nebula-graph.io/nebula created
    3. 返回:

      1. 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个。步骤如下:

    1. apps_v1alpha1_nebulacluster.yaml文件中storaged.replicas的参数值从3改为5

      1. storaged:
      2. resources:
      3. requests:
      4. cpu: "1"
      5. limits:
      6. cpu: "1"
      7. memory: "1Gi"
      8. replicas: 5
      9. image: vesoft/nebula-storaged
      10. version: v2.5.1
      11. storageClaim:
      12. requests:
      13. storage: 2Gi
      14. storageClassName: fast-disks
    2. 执行以下命令使上述更新同步至Nebula Graph集群CR中。

    3. 查看Storage服务的副本数。

      1. kubectl get pods -l app.kubernetes.io/cluster=nebula
      1. NAME READY STATUS RESTARTS AGE
      2. nebula-graphd-0 1/1 Running 0 2m
      3. nebula-metad-0 1/1 Running 0 2m
      4. nebula-storaged-0 1/1 Running 0 2m
      5. nebula-storaged-1 1/1 Running 0 2m
      6. nebula-storaged-2 1/1 Running 0 2m
      7. nebula-storaged-3 1/1 Running 0 5m

      由上可看出Storage服务的副本数被扩容至5个。

    缩容集群

    缩容集群的原理和扩容一样,用户只需将文件中的replicas的值缩小。具体操作,请参考上文的扩容集群部分。

    Caution

    目前仅支持对Nebula Graph集群中的Graph服务和Storage服务进行扩缩容,不支持扩缩容Meta服务。

    使用Kubectl删除Nebula Graph集群的命令如下: