Skip to content

Commit ece99ed

Browse files
authored
Merge pull request #3945 from ClickHouse/aashishkohli-patch-4
Update export-backups-to-own-cloud-account.md
2 parents c28c0d7 + 989e314 commit ece99ed

File tree

2 files changed

+58
-15
lines changed

2 files changed

+58
-15
lines changed

docs/cloud/manage/backups/export-backups-to-own-cloud-account.md

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,19 @@ You will need the following details to export/restore backups to your own CSP st
6161
2. Access HMAC key and HMAC secret.
6262
6363
<hr/>
64-
# Backup / Restore
64+
65+
# Backup / restore {#backup-restoer}
6566
6667
:::note:::
6768
1. For restoring the backup from your own bucket into a new service, you will need to update the trust policy of your backups storage bucket to allow access from the new service.
6869
2. The Backup / Restore commands need to be run from the database command line. For restore to a new service, you will first need to create the service and then run the command.
6970
:::
7071
71-
## Backup / Restore to AWS S3 Bucket {#backup--restore-to-aws-s3-bucket}
72+
## Backup / restore to AWS S3 bucket {#backup--restore-to-aws-s3-bucket}
7273
73-
### Take a DB Backup {#take-a-db-backup}
74+
### Take a DB backup {#take-a-db-backup}
7475
75-
**Full Backup**
76+
**Full backup**
7677
7778
```sql
7879
BACKUP DATABASE test_backups
@@ -86,11 +87,11 @@ You will need to use a different UUID for each new backup in this subdirectory,
8687
For example, if you are taking daily backups, you will need to use a new UUID each day.
8788
:::
8889

89-
**Incremental Backup**
90+
**Incremental backup**
9091

9192
```sql
9293
BACKUP DATABASE test_backups
93-
TO S3('https://testchbackups.s3.amazonaws.com/backups/<uuid>', '<key id>', '<key secret>')
94+
TO S3('https://testchbackups.s3.amazonaws.com/backups/<uuid>/my_incremental', '<key id>', '<key secret>')
9495
SETTINGS base_backup = S3('https://testchbackups.s3.amazonaws.com/backups/<base-backup-uuid>', '<key id>', '<key secret>')
9596
```
9697

@@ -104,11 +105,11 @@ FROM S3('https://testchbackups.s3.amazonaws.com/backups/<uuid>', '<key id>', '<k
104105

105106
See: [Configuring BACKUP/RESTORE to use an S3 Endpoint](/operations/backup#configuring-backuprestore-to-use-an-s3-endpoint) for more details.
106107

107-
## Backup / Restore to Azure Blob Storage {#backup--restore-to-azure-blob-storage}
108+
## Backup / restore to Azure Blob Storage {#backup--restore-to-azure-blob-storage}
108109

109-
### Take a DB Backup {#take-a-db-backup-1}
110+
### Take a DB backup {#take-a-db-backup-1}
110111

111-
**Full Backup**
112+
**Full backup**
112113

113114
```sql
114115
BACKUP DATABASE test_backups
@@ -117,7 +118,7 @@ TO AzureBlobStorage('<AzureBlobStorage endpoint connection string>', '<container
117118

118119
Where `uuid` is a unique identifier, used to differentiate a set of backups.
119120

120-
**Incremental Backup**
121+
**Incremental backup**
121122

122123
```sql
123124
BACKUP DATABASE test_backups
@@ -135,19 +136,19 @@ FROM AzureBlobStorage('<AzureBlobStorage endpoint connection string>', '<contain
135136

136137
See: [Configuring BACKUP/RESTORE to use an S3 Endpoint](/operations/backup#configuring-backuprestore-to-use-an-azureblobstorage-endpoint) for more details.
137138

138-
## Backup / Restore to Google Cloud Storage (GCS) {#backup--restore-to-google-cloud-storage-gcs}
139+
## Backup / restore to Google Cloud Storage (GCS) {#backup--restore-to-google-cloud-storage-gcs}
139140

140-
### Take a DB Backup {#take-a-db-backup-2}
141+
### Take a DB backup {#take-a-db-backup-2}
141142

142-
**Full Backup**
143+
**Full backup**
143144

144145
```sql
145146
BACKUP DATABASE test_backups
146147
TO S3('https://storage.googleapis.com/<bucket>/<uuid>', <hmac-key>', <hmac-secret>)
147148
```
148149
Where `uuid` is a unique identifier, used to differentiate a set of backups.
149150
150-
**Incremental Backup**
151+
**Incremental backup**
151152
152153
```sql
153154
BACKUP DATABASE test_backups
@@ -162,3 +163,43 @@ RESTORE DATABASE test_backups
162163
AS test_backups_restored_gcs
163164
FROM S3('https://storage.googleapis.com/test_gcs_backups/<uuid>', 'key', 'secret')
164165
```
166+
167+
# Granular backups {#granular-backups}
168+
169+
The `BACKUP` command also works with granular backups of specific tables. Example AWS commands for backing up a specific table are listed below. GCP and Azure commands are similar to the ones explained above, except that they need to be customized to backup specific tables.
170+
171+
### Take a granular backup {#take-a-granular-backup}
172+
173+
**Full Backup**
174+
```sql
175+
BACKUP TABLE data TO S3('https://testchbackups.s3.amazonaws.com/backups/<uuid>', '<key id>', '<key
176+
secret>')
177+
```
178+
179+
**Incremental backup**
180+
181+
```sql
182+
BACKUP TABLE data TO S3('https://testchbackups.s3.amazonaws.com/backups/my_incremental/', '<key id>', '<key
183+
secret>') SETTINGS base_backup = S3('https://testchbackups.s3.amazonaws.com/backups/<base-backup-uuid>', '<key id>', '<key
184+
secret>')
185+
```
186+
187+
### Restore from a granular backup {#restore-from-granular-backup}
188+
```sql
189+
RESTORE TABLE data AS data3 FROM
190+
S3('https://testchbackups.s3.amazonaws.com/backups/my_incremental', '<key id>', '<key secret>')
191+
```
192+
193+
### Backup and restore all service data {#backup-and-restore-all-service-data}
194+
195+
**Backup**
196+
197+
```sql
198+
BACKUP TABLE system.settings_profiles, TABLE system.row_policies, TABLE system.quotas, TABLE system.functions, ALL EXCEPT DATABASES INFORMATION_SCHEMA,information_schema,system TO S3('https://testchbackups.s3.amazonaws.com/backups/', '<key id>', '<key secret>')
199+
```
200+
201+
**Restore**
202+
203+
```sql
204+
RESTORE ALL FROM S3('https://testchbackups.s3.amazonaws.com/backups/', '<key id>', '<key secret>')
205+
```

styles/ClickHouse/Headings.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ exceptions:
6363
- Docker Compose
6464
- Kafka
6565
- Google Cloud Run
66+
- Google Cloud Storage
67+
- GCS
6668
- NPM
6769
- OTel
68-
- SQL
70+
- SQL

0 commit comments

Comments
 (0)