使用Helm部署Nebula Graph集群¶
前提条件¶
创建Nebula Graph集群¶
-
添加Nebula Operator chart仓库至Helm(如已创添加,略过前面1至2步,从第3步开始执行)。
helm repo add nebula-operator https://vesoft-inc.github.io/nebula-operator/charts
-
更新Helm仓库,拉取最新仓库资源。
helm repo update
-
配置Helm的环境变量。
export NEBULA_CLUSTER_NAME=nebula # Nebula Graph集群的名字。 export NEBULA_CLUSTER_NAMESPACE=nebula # Nebula Graph集群所处的命名空间的名字。 export STORAGE_CLASS_NAME=gp2 # Nebula Graph集群的StorageClass。
-
为Nebula Graph集群创建命名空间(如已创建,略过此步)。
kubectl create namespace "${NEBULA_CLUSTER_NAMESPACE}"
-
创建Nebula Graph集群。
helm install "${NEBULA_CLUSTER_NAME}" nebula-operator/nebula-cluster \ --namespace="${NEBULA_CLUSTER_NAMESPACE}" \ --set nameOverride=${NEBULA_CLUSTER_NAME} \ --set nebula.storageClassName="${STORAGE_CLASS_NAME}"
-
查看Nebula Graph集群创建状态。
返回示例: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
扩缩容集群¶
用户可通过定义Nebula Graph中不同服务对应的replicas
的值扩缩容Nebuala Graph集群。
例如,扩容Nebula Graph集群中Storage的副本数为5(原始值为2),命令如下:
helm upgrade "${NEBULA_CLUSTER_NAME}" nebula-operator/nebula-cluster \
--namespace="${NEBULA_CLUSTER_NAMESPACE}" \
--set nameOverride=${NEBULA_CLUSTER_NAME} \
--set nebula.storageClassName="${STORAGE_CLASS_NAME}" \
--set nebula.storaged.replicas=5
同理,将Nebula Graph集群中服务对应的replicas
的值设置成小于原始值,即可实现集群服务的缩容。
Caution
目前仅支持对Nebula Graph集群中的Graph服务和Storage服务进行扩缩容,不支持扩缩容Meta服务。
用户可点击nebula-cluster/values.yaml查看Nebula Cluster集群Chart的更多配置。有关文件中配置项的解释,参考下文Nebula Graph集群Chart配置参数说明。
删除集群¶
使用Helm删除集群的命令如下:
helm uninstall "${NEBULA_CLUSTER_NAME}" --namespace="${NEBULA_CLUSTER_NAMESPACE}"
后续操作¶
Nebula Graph集群Chart配置参数说明¶
参数 | 默认值 | 描述 |
---|---|---|
nameOverride |
nil |
覆盖集群Chart的名称。 |
nebula.version |
v2.5.1 |
Nebula Graph的版本。 |
nebula.imagePullPolicy |
IfNotPresent |
Nebula Graph镜像的拉取策略。关于拉取策略详情,请参考Image pull policy。 |
nebula.storageClassName |
nil |
持久存储卷的类型,默认使用StorageClass的名字。 |
nebula.schedulerName |
default-scheduler |
Nebula Graph集群的调度器。 |
nebula.reference |
{"name": "statefulsets.apps", "version": "v1"} |
为Nebula Graph引用的工作负载。 |
nebula.podLabels |
{} |
Nebula Graph服务Pod的标签。 |
nebula.podAnnotations |
{} |
Nebula Graph服务的注解。 |
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.storage |
1Gi |
Graphd服务的存储大小值。 |
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.storage |
1Gi |
Graphd服务的存储大小值。 |
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.storage |
1Gi |
Storaged服务的存储空间值。 |
imagePullSecrets |
[] |
拉取镜像的Secret。 |
最后更新: September 28, 2021