由于 Repository is already locked 错误,无法创建备份

由于存储库被锁定,您无法使用 OADP 实用程序创建备份。

故障现象

CPD-CLI*.log 文件中,您会看到以下错误信息:

stderr=unable to create lock in backend: repository is already locked

原因

S3 桶已被另一个线程锁定。

解决问题

要解决问题,请执行以下步骤:

  1. 设置以下环境变量:
    OADP_OPERATOR_NS=<OADP_operator_project>
    NODE_AGENT_POD=$(oc get pods -l name=node-agent -o jsonpath='{.items[0].metadata.name}' -n ${OADP_OPERATOR_NS})
  2. 连接到 OADP 容器:
    oc rsh -n ${OADP_OPERATOR_NS} ${NODE_AGENT_POD}
  3. 解锁存储库:
    restic unlock -r s3:https://<server>:<port>/<bucket>/<prefix>/restic/${PROJECT_CPD_INST_OPERANDS} --insecure-tls --remove-all
  4. 清理农药豆荚
    oc delete resticrepositories --all -n ${OADP_OPERATOR_NS}
    oc delete pods -l component=velero -n ${OADP_OPERATOR_NS}
    oc delete pods -l  app.kubernetes.io/name=velero -n ${OADP_OPERATOR_NS}
  5. 重置 OADP 实用程序:
    cpd-cli oadp reset
  6. 如果在 Velero pod 日志中看到 Velero pod 的 OOMKilled Kubernetes 错误,请在 DataProtectionApplication (DPA)配置中增加 Restic 和 Velero 的内存。
    1. 编辑 DPA 配置:
      oc edit dpa
    2. 更新以下位置的内存限制:
      • spec.configuration.velero.podConfig.resourceAllocations.limits.memory
      • spec.configuration.nodeAgent.podConfig.resourceAllocations.limits.memory
      例如:
      spec:
        configuration:
          velero:
            customPlugins:
            - image: ${CPDBR_VELERO_PLUGIN_IMAGE_LOCATION}
              name: cpdbr-velero-plugin
            defaultPlugins:
            - aws
            - openshift
            - csi
            podConfig:
              resourceAllocations:
                limits:
                  cpu: "${VELERO_POD_CPU_LIMIT}"
                  memory: 4Gi
                requests:
                  cpu: 500m
                  memory: 256Mi
            resourceTimeout: 60m
          nodeAgent:
            enable: true
            uploaderType: restic
            timeout: 72h
            podConfig:
              resourceAllocations:
                limits:
                  cpu: "${NODE_AGENT_POD_CPU_LIMIT}"
                  memory: 32Gi
                requests:
                  cpu: 500m
                  memory: 256Mi
              tolerations:
              - key: icp4data
                operator: Exists
                effect: NoSchedule
提示: 有关此问题的更多信息,请参阅使用 restic 备份工具解锁锁定的版本库