A warehouse is backed up every day inside its backup window, with ClickHouse’s own BACKUP, for every
database. Backups are incremental against the one before, with a full backup every 7th day, and are
kept for the warehouse’s retention period. You reach them only through the API, the CLI and the
console.
| Setting | |
|---|---|
backups.enabled |
On by default. |
backups.retentionDays |
How long backups are kept, 1 to 35 days. 7 by default. |
backups.windowUtc |
When the daily backup is taken, HH:MM-HH:MM in UTC. |
ezgh warehouse warehouses update whs_4k2m9x0a7qpe --backup-retention-days 14 --backup-window 03:00-04:00 --waitA backup holds every database’s tables and data. A backup is succeeded only when every shard’s part of it succeeded. If a daily backup fails, the
project’s notifications say so.
Back up now
ezgh warehouse backups create whs_4k2m9x0a7qpe --wait
ezgh warehouse backups list whs_4k2m9x0a7qpeIn the console, choose Back up now on the warehouse’s Backups tab.
Restore
A restore creates a new warehouse with the backup’s number of shards. It needs
warehouse.warehouses.query on the backup’s warehouse, since it reads all of its data, as well as what
creating a warehouse needs. A backup’s ID is a UUID, and its shard count is the one it was taken with:
ezgh warehouse backups get shows both, with the restore command.
ezgh warehouse backups get whs_4k2m9x0a7qpe <backup ID>
ezgh warehouse warehouses create analytics-restored --from-backup whs_4k2m9x0a7qpe/<backup ID> --shards 2 \
--replicas 2 --instance-type gp-1.large --storage-size-gib 500 --subnet sbn_2m9x0a7qpe4k --waitIn the console, choose Restore to a new warehouse on a succeeded backup’s row: the shard count is set to the backup’s. The new warehouse has its own ID, name and backups.
The backup’s warehouse’s users come across with the same permissions and new passwords, each in a new Secret in the project. Connections aren’t restored: their credentials belonged to the backup’s warehouse, so create them again on the new one (Load data).
Tables that read through a connection, such as a Kafka engine table, aren’t restored either. The
new warehouse lists them in restore.skippedTables once the restore ends, and
ezgh warehouse warehouses get shows them. Create the connection again, then the table: a
materialized view that read from it was restored and starts reading again once the table exists.
A recreated Kafka table is a new consumer group, so it reads its topics again from the start. Load into
a ReplacingMergeTree ordered by the message’s ID so the re-read adds no duplicates: repeated rows are
merged away in the background, and SELECT … FINAL leaves them out before then.
When a warehouse is deleted
Deleting a warehouse deletes its backups.