跳转至

使用 Helm 部署 NebulaGraph 集群

历史版本兼容性

1.x 版本的 NebulaGraph Operator 不兼容 3.x 以下版本的 NebulaGraph。

前提条件

创建 NebulaGraph 集群

  1. 添加 NebulaGraph Operator chart 仓库至 Helm(如已创添加,略过前面 1 至 2 步,从第 3 步开始执行)。

    helm repo add nebula-operator https://vesoft-inc.github.io/nebula-operator/charts
    
  2. 更新 Helm 仓库,拉取最新仓库资源。

    helm repo update
    
  3. 配置 Helm 的环境变量。

    export NEBULA_CLUSTER_NAME=nebula         # NebulaGraph 集群的名字。
    export NEBULA_CLUSTER_NAMESPACE=nebula    # NebulaGraph 集群所处的命名空间的名字。
    export STORAGE_CLASS_NAME=fast-disks             # NebulaGraph 集群的 StorageClass。
    
  4. 为 NebulaGraph 集群创建命名空间(如已创建,略过此步)。

    kubectl create namespace "${NEBULA_CLUSTER_NAMESPACE}"
    
  5. 创建 NebulaGraph 集群。

    helm install "${NEBULA_CLUSTER_NAME}" nebula-operator/nebula-cluster \
        --namespace="${NEBULA_CLUSTER_NAMESPACE}" \
        --set nameOverride=${NEBULA_CLUSTER_NAME} \
        --set nebula.storageClassName="${STORAGE_CLASS_NAME}"
    
  6. 查看 NebulaGraph 集群创建状态。

    kubectl -n "${NEBULA_CLUSTER_NAMESPACE}" get pod -l "app.kubernetes.io/cluster=${NEBULA_CLUSTER_NAME}"
    

    返回示例:

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

扩缩容集群

  • 不支持扩缩容社区版的 NebulaGraph 集群。

删除集群

使用 Helm 删除集群的命令如下:

helm uninstall "${NEBULA_CLUSTER_NAME}" --namespace="${NEBULA_CLUSTER_NAMESPACE}"

或者使用真实值删除集群,例如:

helm uninstall nebula --namespace=nebula

后续操作

连接 NebulaGraph 数据库

NebulaGraph 集群 Chart 配置参数说明

参数 默认值 描述
nameOverride nil 覆盖集群 Chart 的名称。
nebula.version v3.3.0 NebulaGraph 的版本。
nebula.imagePullPolicy IfNotPresent NebulaGraph 镜像的拉取策略。关于拉取策略详情,请参考 Image pull policy
nebula.storageClassName nil 持久存储卷的类型,默认使用 StorageClass 的名字。
nebula.schedulerName default-scheduler NebulaGraph 集群的调度器。
nebula.reference {"name": "statefulsets.apps", "version": "v1"} 为 NebulaGraph 引用的工作负载。
nebula.graphd.image vesoft/nebula-graphd Graphd 容器镜像名称。使用 nebula.version中的值作为版本。
nebula.graphd.replicas 2 Graphd 服务的副本数。
nebula.graphd.env [] Graphd 服务的环境变量。
nebula.graphd.resources {"resources":{"requests":{"cpu":"500m","memory":"500Mi"},"limits":{"cpu":"1","memory":"1Gi"}}} Graphd 资源配置。
nebula.graphd.logStorage 500Mi Graphd 服务的日志盘大小。
nebula.graphd.podLabels {} Graphd 服务 Pod 的标签。
nebula.graphd.podAnnotations {} Graphd 服务 Pod 的注解。
nebula.graphd.nodeSelector {} 为 Graphd pod 设置节点标签以分配至指定的节点中。
nebula.graphd.tolerations {} 为 Graphd pod 设置容忍度。
nebula.graphd.affinity {} 为 Graphd pod 设置亲和性。
nebula.graphd.readinessProbe {} 为 Graphd pod 设置就绪探针以检测容器的状态。
nebula.graphd.sidecarContainers {} 为 Graphd pod 设置 Sidecar Containers。
nebula.graphd.sidecarVolumes {} 为 Graphd pod 设置 Sidecar Volumes。
nebula.metad.image vesoft/nebula-metad Metad 容器镜像名称。使用 nebula.version中的值作为版本。
nebula.metad.replicas 3 Metad 服务的副本数。
nebula.metad.env [] Metad 服务的环境变量。
nebula.metad.resources {"resources":{"requests":{"cpu":"500m","memory":"500Mi"},"limits":{"cpu":"1","memory":"1Gi"}}} Metad 服务的资源配置。
nebula.metad.logStorage 500Mi Metad 服务的日志盘大小。
nebula.metad.dataStorage 1Gi Metad 服务的数据盘大小。
nebula.metad.license {} 创建企业版 NebulaGraph 集群所需的 License 配置。
nebula.metad.podLabels {} Metad 服务 Pod 的标签。
nebula.metad.podAnnotations {} Metad 服务 Pod 的注解。
nebula.metad.nodeSelector {} 为 Metad pod 设置节点标签以分配至指定的节点中。
nebula.metad.tolerations {} 为 Metad pod 设置容忍度。
nebula.metad.affinity {} 为 Metad pod 设置亲和性。
nebula.metad.readinessProbe {} 为 Metad pod 设置就绪探针以检测容器的状态。
nebula.metad.sidecarContainers {} 为 Metad pod 设置 Sidecar Containers。
nebula.metad.sidecarVolumes {} 为 Metad pod 设置 Sidecar Volumes。
nebula.storaged.image vesoft/nebula-storaged Storaged 容器镜像名称。使用 nebula.version中的值作为版本。
nebula.storaged.replicas 3 Storaged 服务的副本数。
nebula.storaged.env [] Storaged 服务的环境变量。
nebula.storaged.resources {"resources":{"requests":{"cpu":"500m","memory":"500Mi"},"limits":{"cpu":"1","memory":"1Gi"}}} Storaged 服务的资源配置。
nebula.storaged.logStorage 500Mi Storaged 服务的日志盘大小。
nebula.storaged.dataStorage 1Gi Storaged 服务的数据盘大小。
nebula.storaged.podLabels {} Storaged 服务 Pod 的标签。
nebula.storaged.podAnnotations {} Storaged 服务 Pod 的注解。
nebula.storaged.nodeSelector {} 为 Storaged pod 设置节点标签以分配至指定的节点中。
nebula.storaged.tolerations {} 为 Storaged pod 设置容忍度。
nebula.storaged.affinity {} 为 Storaged pod 设置亲和性。
nebula.storaged.readinessProbe {} 为 Storaged pod 设置就绪探针以检测容器的状态。
nebula.storaged.sidecarContainers {} 为 Storaged pod 设置 Sidecar Containers。
nebula.storaged.sidecarVolumes {} 为 Storaged Pod 设置 Sidecar Volumes。
imagePullSecrets [] 拉取镜像的 Secret。

最后更新: March 28, 2023