【问题标题】:Longhorn backup/snapshot hooksLonghorn 备份/快照挂钩
【发布时间】:2021-06-01 18:20:34
【问题描述】:

如何配置 Longhorn 备份,以便它在拍摄快照/备份之前和之后在 pod 中执行一些 bash 脚本?

类似于 Velero 的备用钩子的东西。

  annotations:
    backup.velero.io/backup-volumes: data
    pre.hook.backup.velero.io/command: "['/usr/bin/mysql', '-e', '\"flush tables with read lock;\"']"
    pre.hook.backup.velero.io/container: mysql
    post.hook.backup.velero.io/command: "['/usr/bin/mysql', '-e', '\"unlock tables;\"']"
    post.hook.backup.velero.io/container: mysql

【问题讨论】:

    标签: kubernetes rancher longhorn


    【解决方案1】:

    根据longhorn github issue,目前显然不可能。

    您可以使用volume snapshot 来编排类似的行为

    kubectl exec mypod-id -- app_freeze
    kubectl apply -f volumesnapshot.yaml
    kubectl exec mypod-id -- app_thaw
    

    volumesnapshot.yaml 在哪里:

    apiVersion: snapshot.storage.k8s.io/v1
    kind: VolumeSnapshot
    metadata:
      name: my-longhorn-snapshot
    spec:
      volumeSnapshotClassName: longhorn
      source:
        persistentVolumeClaimName: my-longhorn-pvc
    

    查看 IRIS 数据库示例:https://community.intersystems.com/post/amazon-eks-and-iris-high-availability-and-backup

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-12
      • 2020-01-12
      • 1970-01-01
      • 2018-08-28
      • 2012-11-29
      相关资源
      最近更新 更多