I’m using the latest version of Windows Docker (with WSL2) and Couchbase community 7.0.2. I’m trying to update our backup and restore scripts to use cbbackupmgr since the old tools are deprecated. I have successfully created a backup using this command from inside the Docker container containing Couchbase:
/opt/couchbase/bin/cbbackupmgr backup -a /usr/local/halix/backup -r prod -c http://localhost:8091 -u $DB_USERNAME -p $DB_PASSWORD --full-backup
I am attempting to now restore the backup on the same server, but a different Docker container containing a fresh Couchbase instance and empty buckets. I’m using these commands from inside the Docker instance:
couchbase-cli cluster-init --cluster-username=$DB_USERNAME --cluster-password=$DB_PASSWORD --cluster-ramsize=1024 --cluster-index-ramsize=256 --services=data,index,query
couchbase-cli bucket-create -c 127.0.0.1:8091 -u $DB_USERNAME -p $DB_PASSWORD --bucket=halix2 --bucket-ramsize=768 --bucket-type=couchbase
couchbase-cli bucket-create -c 127.0.0.1:8091 -u $DB_USERNAME -p $DB_PASSWORD --bucket=halixsessions --bucket-ramsize=128 --bucket-type=couchbase
couchbase-cli bucket-create -c 127.0.0.1:8091 -u $DB_USERNAME -p $DB_PASSWORD --bucket=usage --bucket-ramsize=128 --bucket-type=couchbase
cbbackupmgr restore -a /usr/local/halix/backup -r prod -c http://localhost:8091 -u $DB_USERNAME -p $DB_PASSWORD
The result is the command is successful. All 3 buckets are listed as successful. However 0 documents were inserted into each of the buckets. When I go to verify the backup data, everything looks fine. I run the command:
cbbackupmgr info -a “/usr/local/halix/backup” -r prod --all
It lists 1 repo called prod, size is 2.59GB, # of backups is 1. There is only 1 backup, 2023-05-09T16_24_07.0331632Z. 2.59GB, full backup, complete=true. It lists the 3 buckets I expect; halix2, halixsessions, and usage. With 2.5million, 17, 608 documents respectively. 153, 2, 0 indexes respectively.
When I run the restore command I listed above, it completes in about 400ms. It says “Restore completed successfully”. However transferred per bucket says 0B. It appears to be ignoring the data. I’ve tried a number of combinations of flags. I’ve tried specifying just one bucket, tried allowing the command to create buckets incase there was a mismatch, tried --force-updates, tried changing the server URL to values like “couchbase://127.0.0.1”, “couchbase://127.0.0.1:8091”, “couchbase://localhost”… etc. Some of them work, but with the same result of no records being inserted. Others fail with an invalid host error. This leads me to believe it isn’t an issue with connecting to the local couchbase instance.
I’ve also verified through the web UI that the 3 buckets exist and are completely empty. There are no documents in any of them. I’ve also verified that the backup directory permissions are ok, adding chmod 777 to it. In order to transfer the backup files from one container to another, I zip up the directory, ship it to AWS S3, download it into the new container, and unzip it to the same directory. The backup is 1.1GB, extracts to ~2.7GB. When I browse the directory structure it looks fine. I opened up the /logs/backup-0.log and went through the very nicely detailed output of the backup process. I noticed nothing of concern. A few "WARN"s for missing services; ‘Search’, ‘Eventing’, ‘Analytics’. I see it spitting out streams for the 3 buckets and at the end it says transfer cluster complete, transfer all data complete, backup completed successfully.
Both docker containers are using the exact same couchbase community 7.0.2 image and thus also the exact same versio of cbbackupmgr on both sides. I am at an absolute loss what might be going on. I don’t see a verbose mode option for the tool. Is there anywhere I can see verbose logging about the restore process? Maybe in the couchbase server logs itself? Could the fact I’m using docker with WSL2 and with Linux containers be leading to anything odd? I mean, as far as I can tell the backup data is there and readable. The restore tool throws no errors of any kind. Hoping anyone has some new suggestions I haven’t tried yet. Tomorrow I’m going to begrudgingly pull in a colleague who uses a MAC and have him try my modified scripts to create a backup of one of his databases and then try to restore it in a new container… see if he encounters the same issue. I have a feeling it’ll just work for him though :/. Any ideas would be greatly appreciated.