Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Solutions
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Managed Service for ClickHouse
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Information about existing clusters
    • Creating clusters
    • Connecting to databases
    • Stop and start the cluster
    • SQL queries in the management console
    • Changing cluster and database settings
    • Connecting to DataLens
    • Connecting external dictionaries
    • Adding your own geobase
    • Enabling machine learning models
    • Changing ClickHouse versions
    • Managing ClickHouse hosts
    • Adding ZooKeeper hosts
    • Database management
    • Managing database users
    • Managing backups
    • How to manage shards
    • Deleting clusters
  • Solutions
    • Adding data to the database
    • Sharding tables
  • Concepts
    • Relationship between service resources
    • Host classes
    • Network in Yandex Managed Service for ClickHouse
    • Quotas and limits
    • Storage types
    • Backups
    • Replication
    • Dictionaries
    • Sharding
    • Supported clients
  • Access management
  • Pricing policy
    • Current pricing policy
    • Archive
      • Before January 1, 2019
      • From January 1 to March 1, 2019
      • From March 1, 2019 to February 1, 2020
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • BackupService
      • ClusterService
      • DatabaseService
      • FormatSchemaService
      • MlModelService
      • ResourcePresetService
      • UserService
      • VersionsService
      • OperationService
    • REST
      • Overview
      • Backup
        • Overview
        • get
        • list
      • Cluster
        • Overview
        • addHosts
        • addShard
        • addZookeeper
        • backup
        • create
        • createExternalDictionary
        • createShardGroup
        • delete
        • deleteExternalDictionary
        • deleteHosts
        • deleteShard
        • deleteShardGroup
        • get
        • getShard
        • getShardGroup
        • list
        • listBackups
        • listHosts
        • listLogs
        • listOperations
        • listShardGroups
        • listShards
        • move
        • rescheduleMaintenance
        • restore
        • start
        • stop
        • streamLogs
        • update
        • updateShard
        • updateShardGroup
      • Database
        • Overview
        • create
        • delete
        • get
        • list
      • FormatSchema
        • Overview
        • create
        • delete
        • get
        • list
        • update
      • MlModel
        • Overview
        • create
        • delete
        • get
        • list
        • update
      • ResourcePreset
        • Overview
        • get
        • list
      • User
        • Overview
        • create
        • delete
        • get
        • grantPermission
        • list
        • revokePermission
        • update
      • Versions
        • Overview
        • list
      • Operation
        • Overview
        • get
  • Questions and answers
    • General questions
    • Questions about ClickHouse
    • All questions on the same page
  1. Step-by-step instructions
  2. Managing backups

Managing backups

  • Creating backups
  • Restoring clusters from backups
  • Getting a list of backups
  • Getting information about backups
  • Set the backup start time

You can create backups and restore clusters from existing backups.

Creating backups

Management console
CLI
  1. Go to the folder page and select 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 the Yandex.Cloud command line interface yet, install and initialize 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 parameter.

To create a cluster backup:

  1. View a description of the CLI create ClickHouse backup command:

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

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

    The cluster name and ID can be retrieved with the 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 cloud has insufficient resources to create such a cluster, you will not be able to restore from the backup. The average backup recovery speed is 10 MBps per database core.

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).

Management console
CLI
  1. Go to the folder page and select 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 the Yandex.Cloud command line interface yet, install and initialize 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 parameter.

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. Getting a list of available ClickHouse cluster backups:

    $ 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 \
           --host type=clickhouse,zone-id=ru-central1-c,subnet-id=b0rcctk2rvtr8efcch63 \
           --clickhouse-disk-size 20 \
           --clickhouse-disk-type network-ssd \
           --clickhouse-resource-preset s2.micro
    

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

       - Named `mynewch`.
    
    • In the PRODUCTION environment.
    • In the default network.
    • With a single s2.micro class host in the b0rcctk2rvtr8efcch63 subnet of the ru-central1-c availability zone.
    • With the databases and users from the backup.
    • With 20 GB fast network storage (network-ssd).

Getting a list of backups

Management console
CLI
  1. Go to the folder page and select 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 the Yandex.Cloud command line interface yet, install and initialize 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 parameter.

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 backups

Management console
CLI
  1. Go to the folder page and select 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 the Yandex.Cloud command line interface yet, install and initialize 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 parameter.

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

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

The backup ID can be retrieved with the list of backups .

Set the backup start time

Management console
CLI

When creating or updating a cluster, you can set the backup start time under Additional settings.

To set the backup start time, use the -- backup-window-start flag. Time is given in HH:MM:SS format.

$ yc yc managed-clickhouse cluster create \
      --name <cluster name> \
      --environment <prestable or production> \
      --network-name <network name> \
      --host type=<clickhouse or zookeeper>,zone-id=<availability zone>,subnet-id=<subnet ID> \
      --resource-preset <host class> \
      --clickhouse-disk-type <network-hdd | network-ssd | local-ssd> \
      --clickhouse-disk-size <storage size in GB> \
      --user name=<username>,password=<user password> \
      --database name=<DB name>
      --backup-window-start 10:00:00

To change the backup start time in an existing cluster, use the update command:

$ yc yc managed-clickhouse cluster update \
   --name <cluster name> \
   --backup-window-start 11:25:00
In this article:
  • Creating backups
  • Restoring clusters from backups
  • Getting a list of backups
  • Getting information about backups
  • Set the backup start time
Language / Region
Careers
Privacy policy
Terms of use
Brandbook
© 2021 Yandex.Cloud LLC