跳转至

回收 PV

Nebula Operator 使用持久化卷 PV(Persistent Volume)和持久化卷声明 PVC(Persistent Volume Claim)来存储持久化数据。如果用户不小心删除了一个 Nebula Graph 集群,PV 和 PVC 对象及其数据仍可保留,以确保数据安全。

用户可以在集群的 CR 实例的配置文件中通过参数enablePVReclaim定义是否回收 PV。

如果用户需要删除图空间并想保留相关数据,可以更新 Nebula Graph 集群,即设置enablePVReclaimtrue

前提条件

已使用 K8s 创建一个集群。具体步骤,参见使用 Kubectl 创建 Nebula Graph 集群

操作步骤

以下示例使用名为nebula的集群说明如何设置enablePVReclaim

  1. 执行以下命令进入nebula集群的编辑页面。

    kubectl edit nebulaclusters.apps.nebula-graph.io nebula
    
  2. 在 YAML 文件的spec配置项中,添加enablePVReclaim并设置其值为true

    apiVersion: apps.nebula-graph.io/v1alpha1
    kind: NebulaCluster
    metadata:
      name: nebula
    spec:
      enablePVReclaim: true  //设置其值为 true。
      graphd:
        image: vesoft/nebula-graphd
        logVolumeClaim:
          resources:
            requests:
              storage: 2Gi
          storageClassName: fast-disks
        replicas: 1
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 500m
            memory: 500Mi
        version: v2.6.1
      imagePullPolicy: IfNotPresent
      metad:
        dataVolumeClaim:
          resources:
            requests:
              storage: 2Gi
          storageClassName: fast-disks
        image: vesoft/nebula-metad
        logVolumeClaim:
          resources:
            requests:
              storage: 2Gi
          storageClassName: fast-disks
        replicas: 1
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 500m
            memory: 500Mi
        version: v2.6.1
      nodeSelector:
        nebula: cloud
      reference:
        name: statefulsets.apps
        version: v1
      schedulerName: default-scheduler
      storaged:
        dataVolumeClaim:
          resources:
            requests:
              storage: 2Gi
          storageClassName: fast-disks
        image: vesoft/nebula-storaged
        logVolumeClaim:
          resources:
            requests:
              storage: 2Gi
          storageClassName: fast-disks
        replicas: 3
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 500m
            memory: 500Mi
        version: v2.6.1
    ...    
    

最后更新: November 24, 2021
Back to top