Backup / restore via user-interface

- I. Go to Cloud Storage in the Google Cloud Console, and select `Settings`
  - II Go to the Interoperability tab.
  - III. In the `Service account HMAC` section, click `Create a key for a service account`.
  - IV. Choose the service account you created in the previous step from the dropdown menu.
  - V. Click `Create key`.
- c. Securely store the credentials:

  - I. The system will display the Access ID (your HMAC key) and the Secret (your HMAC secret). Save these values, as
    the secret won't be displayed again after you close this window.

#### Steps to follow in ClickHouse Cloud[​](#gcp-cloud-steps "Direct link to Steps to follow in ClickHouse Cloud")

Follow the steps below in the ClickHouse Cloud console to configure the external bucket:

Change external backup

##### Change external backup[​](#gcp-configure-external-bucket "Direct link to Change external backup")

On the `Settings` page, click on `Change external backup`

Configure GCP HMAC Key and Secret

##### Configure GCP HMAC Key and Secret[​](#gcp-configure-gcp-hmac-key-and-secret "Direct link to Configure GCP HMAC Key and Secret")

In the popup dialogue, provide the GCP bucket path, HMAC key and Secret created in the previous section.

Save external bucket

##### Save external bucket[​](#gcp-save-external-bucket "Direct link to Save external bucket")

Click on `Save External Bucket` to save the settings.

Changing the backup schedule from the default schedule

##### Changing the backup schedule from the default schedule[​](#gcp-changing-the-backup-schedule "Direct link to Changing the backup schedule from the default schedule")

External Backups will now happen in your bucket on the default schedule.
Alternatively, you can configure the backup schedule from the `Settings` page.
If configured differently, the custom schedule is used to write backups to your
bucket and the default schedule (backups every 24 hours) is used for backups in
ClickHouse cloud owned bucket.

View backups stored in your bucket

##### View backups stored in your bucket[​](#gcp-view-backups-stored-in-your-bucket "Direct link to View backups stored in your bucket")

The Backups page should display these backups in your bucket in a separate table as shown below:

### Restoring backups from GCP[​](#gcp-restoring-backups-from-gcp "Direct link to Restoring backups from GCP")

Follow the steps below to restore backups from GCP:

Create a new service to restore to

##### Create a new service to restore to[​](#gcp-create-new-service-to-restore-to "Direct link to Create a new service to restore to")

Create a new service to restore the backup to.

Get SQL command used to restore backup

##### Get SQL command used to restore backup[​](#gcp-obtain-sql-command-to-restore-backup "Direct link to Get SQL command used to restore backup")

Click on the `access or restore a backup` link above the list of backups in the
UI to get the SQL command to restore the backup. The command should look like this,
and you can pick the appropriate backup from the dropdown to get the restore
command for that specific backup. You will need to add your secret access key
to the command:

Moving backups to another location

If you move the backups to another location, you will need to customize the restore command to reference the new location.

ASYNC command

For the Restore command you can also optionally add an `ASYNC` command at the end for large restores.
This allows the restores to happen asynchronously, so that if connection is lost, the restore keeps running.
It is important to note that the ASYNC command immediately returns a status of success.
This doesn't mean the restore was successful.
You will need to monitor the `system.backups` table to see if the restore has finished and if it succeeded or failed.

Run SQL command to restore backup

##### Run SQL command to restore backup[​](#gcp-run-sql-command-to-restore-backup "Direct link to Run SQL command to restore backup")

Run the restore command from the SQL console in the newly created service to
restore the backup.

## Azure[​](#azure "Direct link to Azure")

### Taking backups to Azure[​](#taking-backups-to-azure "Direct link to Taking backups to Azure")

Follow the steps below to take backups to Azure:

#### Steps to follow in Azure[​](#steps-to-follow-in-azure "Direct link to Steps to follow in Azure")

Create a storage account

##### Create a storage account[​](#azure-create-a-storage-account "Direct link to Create a storage account")

Create a storage account or select an existing storage account in the Azure
portal where you want to store your backups.

Get connection string

##### Get connection string[​](#azure-get-connection-string "Direct link to Get connection string")

- a. In your storage account overview, look for the section called `Security + networking` and click on `Access keys`.
- b. Here, you will see `key1` and `key2`. Under each key, you’ll find a `Connection string` field.
- c. Click `Show` to reveal the connection string. Copy the connection string which you will use to for set-up on ClickHouse Cloud.

#### Steps to follow in ClickHouse Cloud[​](#azure-cloud-steps "Direct link to Steps to follow in ClickHouse Cloud")

Follow the steps below in the ClickHouse Cloud console to configure the external bucket:

Change external backup

##### Change external backup[​](#azure-configure-external-bucket "Direct link to Change external backup")

On the `Settings` page, click on `Change external backup`

Provide connection string and container name for your Azure storage account

##### Provide connection string and container name for your Azure storage account[​](#azure-provide-connection-string-and-container-name-azure "Direct link to Provide connection string and container name for your Azure storage account")

On the next screen provide the Connection String and Container Name for your
Azure storage account created in the previous section:

Save external bucket

##### Save external bucket[​](#azure-save-external-bucket "Direct link to Save external bucket")

Click on `Save External Bucket` to save the settings

Changing the backup schedule from the default schedule

##### Changing the backup schedule from the default schedule[​](#azure-changing-the-backup-schedule "Direct link to Changing the backup schedule from the default schedule")

External Backups will now happen in your bucket on the default schedule. Alternatively,
you can configure the backup schedule from the “Settings” page. If configured differently,
the custom schedule is used to write backups to your bucket and the default schedule
(backups every 24 hours) is used for backups in ClickHouse cloud owned bucket.

View backups stored in your bucket

##### View backups stored in your bucket[​](#azure-view-backups-stored-in-your-bucket "Direct link to View backups stored in your bucket")

The Backups page should display these backups in your bucket in a separate table
as shown below:

### Restoring backups from Azure[​](#azure-restore-steps "Direct link to Restoring backups from Azure")

To restore backups from Azure, follow the steps below:

Create a new service to restore to

##### Create a new service to restore to[​](#azure-create-new-service-to-restore-to "Direct link to Create a new service to restore to")

Create a new service to restore the backup to. Currently, we only support
restoring a backup into a new service.

Get SQL command used to restore backup

##### Get SQL command used to restore backup[​](#azure-obtain-sql-command-to-restore-backup "Direct link to Get SQL command used to restore backup")

Click on the `access or restore a backup` link above the list of backups in the
UI to obtain the SQL command to restore the backup. The command should look like
this, and you can pick the appropriate backup from the dropdown to get the
restore command for that specific backup. You will need to add your Azure
storage account connection string to the command.

Moving backups to another location

If you move the backups to another location, you will need to customize the restore command to reference the new location.

ASYNC command