Skip to main content

Restore

Restore a tenant from a dump file

Examples​

Basic usage:

octo-cli -c Restore `
-tid "mytenant" `
-db "mytenant_db" `
-f "./backup.tar.gz" `
-w

Restore CrateDB archive data from an '*.octobak.zip' backup:

octo-cli -c Restore `
-tid "mytenant" `
-db "mytenant_db" `
-f "./backup.octobak.zip" `
-rad `
-w

Options​

ShortLongRequiredDescription
-tid--tenantIdyesId of tenant
-db--databaseyesName of database
-f--fileyesFile of backup (*.tar.gz or *.octobak.zip)
-oldDb--oldDatabaseNamenoName of the old database (if different to new database name)
-rad--restore-archive-datanoRestore CrateDB archive data contained in an '.octobak.zip' backup (no-op on a plain '.tar.gz')
-ps--part-size-mibnoSize of one upload request in MiB (default 50, from 1 to 90). Keep it below the body limit of the ingress (100 MiB on staging-1, prod-1 and prod-2).
-ofo--override-foreign-ownershipnoDeliberately overwrite a tenant database that records another OctoMesh instance on the same MongoDB server as its owner while no instance registers it any more (refused without this flag). The service logs the override. A database another instance still registers, and another instance's system database, are refused even with this flag.
-w--waitnoWait for a import job to complete

Notes​

--restore-archive-data restores archives to their backed-up state; it is a no-op on a plain '*.tar.gz' backup.

Restoring into a scratch tenant: there is no --scratch flag on Restore. Create the tenant with Create --scratch, log in to it with the client's mirror (LogInClientCredentials --context <child>) and restore into it with that child token; the scratch record lives outside the tenant database and survives the restore, so the creator stays administrator. A plain restore writes or changes no scratch record.

The backup is uploaded in parts of 50 MiB (change with --part-size-mib), so a backup of several GB passes the body limit of the ingress; an interrupted upload resumes from the server's offset.

When the upload is refused, the command reports the HTTP status, the part number and the offset of the failed part, and no restore job is started.

The target tenant's archive schemas must match those in the backup; mismatched archives are skipped and reported.

A restore into a database that belongs to another OctoMesh instance on the same MongoDB server is refused with the uniform "Database name '...' is not available."; the owner is in the server log only. Detach the tenant in the owning instance first or choose another database name; --override-foreign-ownership overwrites a database whose recorded owner no longer registers it and is logged by the service. A database another instance still registers, and another instance's system database, are never overwritten.