apecloud / kubeblocks

KubeBlocks is an open-source control plane software that runs and manages databases, message queues and other stateful applications on K8s.
https://kubeblocks.io
GNU Affero General Public License v3.0
2.21k stars 184 forks source link

[BUG]1.0 restored pg cluster is not in the cluster list #8546

Open tianyue86 opened 2 days ago

tianyue86 commented 2 days ago

Describe the env

Kubernetes: v1.31.1-aliyun.1
KubeBlocks: 1.0.0-beta.8
kbcli: 1.0.0-beta.3

To Reproduce Steps to reproduce the behavior:

  1. Create pg cluster in running status

    NAMESPACE   NAME              CLUSTER-DEFINITION   TERMINATION-POLICY   STATUS     AGE
    default     postgres-clvutw   postgresql           WipeOut              Running    25h
  2. backup

    kbcli cluster backup postgres-clvutw --method volume-snapshot --namespace default
    Backup backup-default-postgres-clvutw-20241128162659 created successfully, you can view the progress:
    kbcli cluster list-backup --name=backup-default-postgres-clvutw-20241128162659 -n default
  3. check backup status

    kbcli cluster list-backup --names=backup-default-postgres-clvutw-20241128162659 -n default
    NAME                                            NAMESPACE   SOURCE-CLUSTER    METHOD            STATUS      TOTAL-SIZE   DURATION   DELETION-POLICY   CREATE-TIME                  COMPLETION-TIME              EXPIRATION   
    backup-default-postgres-clvutw-20241128162659   default     postgres-clvutw   volume-snapshot   Completed   20Gi         11s        Delete            Nov 28,2024 16:27 UTC+0800   Nov 28,2024 16:27 UTC+0800 
  4. restore

    kbcli cluster restore postgres-clvutw-backup --backup  --restore-to-time "Nov 28,2024 17:15:16 UTC+0800"  --namespace default
    Cluster postgres-clvutw-backup created
  5. check ops

    kbcli cluster list-ops --status all  --namespace default
    NAME                                  NAMESPACE   TYPE            CLUSTER                  COMPONENT   STATUS     PROGRESS   CREATED-TIME                 
    redis-tnmept-reconfiguring-vw8fl      default     Reconfiguring   redis-tnmept                         Failed     -/-        Nov 27,2024 11:06 UTC+0800   
    mongo-bxkpkz-switchover-pd4wv         default     Switchover      mongo-bxkpkz             mongodb     Succeed    1/1        Nov 27,2024 18:18 UTC+0800   
    mongo-bxkpkz-restart-6p9hs            default     Restart         mongo-bxkpkz             mongodb     Succeed    3/3        Nov 27,2024 18:23 UTC+0800   
    postgres-clvutw-reconfiguring-4mh5s   default     Reconfiguring   postgres-clvutw                      Failed     -/-        Nov 28,2024 15:42 UTC+0800   
    postgres-clvutw-backup                default     Restore         postgres-clvutw-backup               Creating   -/-        Nov 28,2024 20:29 UTC+0800 
  6. check cluster

    tianyue@apeclouds-MacBook-Pro kbcli % k get cluster -A|grep postgres-clvutw-backup
    tianyue@apeclouds-MacBook-Pro kbcli % 

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

shanshanying commented 2 days ago
  1. this is a volume sanpshot backup, does not support PITR ( as specified in --method volume-snapshot )
  2. restore from a backup
    kbcli cluster restore postgres-clvutw-backup --backup  --restore-to-time "Nov 28,2024 17:15:16 UTC+0800"  --namespace default

    You did not even specify a backup name for '--backup'

shanshanying commented 2 days ago

But KBCLI short report error on this. @yipeng1030 please check why the command succeed without a backup arg.

tianyue86 commented 2 days ago

~kbcli cluster restore postgres-clvutw-backup --backup backup-default-postgres-clvutw-20241128162659--namespace default Cluster postgres-clvutw-backup created

tianyue@apeclouds-MacBook-Pro kbcli % k get cluster -A|grep postgres-clvutw-backup tianyue@apeclouds-MacBook-Pro kbcli %

===> still no cluster created after doing restore

shanshanying commented 2 days ago
image

Restore Ops is created, but got stuck in Creating Phase.