Managing backups

You can create backups and restore clusters from existing backups.

Creating backups

  1. Go to the folder page and click Managed Service for ClickHouse.
  2. Click on the name of the cluster you need and select the tab Backup copies.
  3. Click Create a backup.

If you don't have Yandex.Cloud CLI, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id flag.

To create a cluster backup:

  1. See the description of the CLI's create backup command ClickHouse:

    $ yc managed-clickhouse cluster backup --help
    
  2. Request creation of a backup specifying the cluster name or ID:

    $ yc managed-clickhouse cluster backup my-mg-cluster
    

    The cluster name and ID can be obtained with a list of clusters.

Restoring clusters from backups

When you restore a cluster from a backup, you create a new cluster with the data from the backup. If the folder has insufficient resources to create such a cluster, you will not be able to restore from the backup.

For a new cluster, you should set all the parameters that are required at creation, except for the cluster type (a ClickHouse backup cannot be restored as a PostgreSQL cluster).

  1. Go to the folder page and click Managed Service for ClickHouse.
  2. Click on the name of the cluster you need and select the tab Backup copies.
  3. Click for the required backup and then click Restore cluster.

If you don't have Yandex.Cloud CLI, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id flag.

To restore a cluster from a backup:

  1. View the description of the CLI's restore cluster command ClickHouse:

    $ yc managed-clickhouse cluster restore --help
    
  2. Get a list of available backups for ClickHouse clusters:

    $ yc managed-clickhouse backup list
    
    +--------------------------+----------------------+----------------------+----------------------+
    |            ID            |      CREATED AT      |  SOURCE CLUSTER ID   |      STARTED AT      |
    +--------------------------+----------------------+----------------------+----------------------+
    | c9qlk4v13uq79r9cgcku:... | 2018-11-02T10:08:38Z | c9qlk4v13uq79r9cgcku | 2018-11-02T10:08:37Z |
    | ...                                                                                           |                          |
    +--------------------------+----------------------+----------------------+----------------------+
    
  3. Request creation of a cluster from a backup:

    $ yc managed-clickhouse cluster restore \
           --backup-id c9q22suuefrmrp2lrv9f:20181109T101204 \
           --name mynewch \
           --environment=PRODUCTION \
           --network-name default-net \
           --host type=clickhouse,zone-id=ru-central1-c,subnet-id=b0rcctk2rvtr8efcch63 \
           --clickhouse-disk-size 20 \
           --clickhouse-disk-type network-nvme \
           --clickhouse-resource-preset s1.nano
    

    This results in a new ClickHouse cluster with the following characteristics:

    • Named mynewch.
    • In the PRODUCTION environment.
    • In the default-net network.
    • With a single host of the s1.nano class in the b0rcctk2rvtr8efcch63 subnet and the ru-central1-c availability zone.
    • With the databases and users from the backup.
    • With SSD network storage of 20 GB.

Getting a list of backups

  1. Go to the folder page and click Managed Service for ClickHouse.
  2. Click on the name of the cluster you need and select the tab Backup copies.

If you don't have Yandex.Cloud CLI, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id flag.

To get a list of ClickHouse cluster backups available in the default folder, run the command:

$ yc managed-clickhouse backup list

+----------+----------------------+----------------------+----------------------+
|    ID    |      CREATED AT      |  SOURCE CLUSTER ID   |      STARTED AT      |
+----------+----------------------+----------------------+----------------------+
| c9qv4... | 2018-10-31T22:01:07Z | c9qv4ql6bd4hfo1cgc3o | 2018-10-31T22:01:03Z |
| c9qpm... | 2018-10-31T22:01:04Z | c9qpm90p3pcg71jm7tqf | 2018-10-31T22:01:04Z |
+----------+----------------------+----------------------+----------------------+

Getting information about a backup

  1. Go to the folder page and click Managed Service for ClickHouse.
  2. Click on the name of the cluster you need and select the tab Backup copies.

If you don't have Yandex.Cloud CLI, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id flag.

To get information about a ClickHouse cluster backup, run the command:

$ yc yc managed-clickhouse backup get <backup ID>

The backup ID can be obtained from a list of backups.