How to restore a backup from a file?

I’m trying to use cbrestore an existing backup into the kubernetes cluster I’m creating but for some reason its saying the destination bucket is missing amongst other things…

To start I’m port-forwarding my pod

kubectl port-forward inform-0000 8091 -n inform

and then running cbrestore (via powershell) from a local directory containing the backup dir

& $cbrestore -u Administrator -p password . http://127.0.0.1:8091/

Mainly resulting in

error: missing bucket-destination: b'construct' at destination: http://127.0.0.1:8091/; perhaps your username/password is missing or incorrect

I know the username/password is correct since I can use the credentials to login to the web ui and from there I can then see that the bucket construct also exists…

I’ve also tried creating a new user with full admin credentials on the web ui which does get created but then disappears when i refresh the page which leads me to believe this might be an issue with the couchbase operator taking full control over the server?

Really confused as to what to try next/where to debug…

Hi @MS

The command you’re running is incorrect; you need to specify --bucket-destination option. Refer to the documentation for cbrestore options.

On the other hand, you have another option to run cbbackup and cbrestore as a Kubernetes job. You can refer to the documentation here for the steps, although those steps are for Enterprise cbbackupmgr. You can replace couchbase/server:enterprise with couchbase/server:community and cbbackupmgr with cbbackup/cbrestore.

Hi, thanks for your reply…

I’ve tried using the bucket-destination option and results in same message (except not referring as a byte string)

PS C:\Users\MWSay\Downloads\backups> & $cbrestore -u Administrator -p password . http://127.0.0.1:8091/
error: missing bucket-destination: b'construct' at destination: http://127.0.0.1:8091/; perhaps your username/password is missing or incorrect

PS C:\Users\MWSay\Downloads\backups> & $cbrestore -u Administrator -p password --bucket-destination construct . http://127.0.0.1:8091/
error: missing bucket-destination: construct at destination: http://127.0.0.1:8091/; perhaps your username/password is missing or incorrect

I’ll look into running as a kubernetes job on monday though, thanks for the tip!

Thanks for the suggestion of using a kubernetes job! Ended up with the following which seems to do the trick for now…

apiVersion: batch/v1
kind: Job
metadata:
  name: couchbase-cluster-restore
spec:
  template:
    spec:
      initContainers:
        - name: wait-for-couchbase
          image: stefanevinance/wait-for-200
          env:
            - name: URL
              value: http://{{ .Values.syncGateway.service.name }}:4984/
      containers:
      - name: couchbase-cluster-restore
        image: {{ .Values.couchbaseop.cluster.image }}
        command: [
          "cbrestore",
          "-u", "Administrator",
          "-p", "password",
          "/backups",
          "couchbase://inform:8091/",
        ]
        volumeMounts:
        - name: couchbase-cluster-backup-volume
          mountPath: /backups
      volumes:
      - name: couchbase-cluster-backup-volume
        hostPath:
          path: /.../backups
      restartPolicy: Never