Skip to main content

Transfer data between storage devices in Aiven for ClickHouse®'s tiered storage Limited availabilty

After enabling the tiered storage feature, you can move your data from SSD to object storage. Next, you may want to size down your SSD by selecting a service plan with less SSD capacity. Later, you can move your data from object storage back to your SSD if needed. Both operations can be performed using SQL statements against your tables directly.

Prerequisites

Transfer data from SSD to object storage

Automatic data transfer from SSD to object storage

If you enable the tiered storage feature on your table, by default your data is moved from SSD to object storage as soon as the SSD reaches 80% of its capacity.

  1. Connect to your Aiven for ClickHouse service using, for example, the ClickHouse client (CLI).

  2. Run the following query:

    ALTER TABLE database-name.tablename MODIFY SETTING storage_policy = 'tiered'

Now, with the tiered storage feature enabled, your data is moved from SSD to object storage when the SSD reaches 80% of its capacity.

note

You can also configure your tiered storage so that data is moved to object storage at a specific time.

Move data manually from SSD to object storage

To move data manually from SSD to object storage, run

ALTER TABLE table_name MOVE PARTITION partition_expr TO VOLUME 'remote'

To configure data retention thresholds to automatically move data from SSD to object storage, see Configure data retention thresholds in Aiven for ClickHouse®'s tiered storage.

Transfer data from object storage to SSD

Use the MOVE statement MOVE PARTITION|PART to transfer data to your SSD.

  1. Connect to your Aiven for ClickHouse service using, for example, the ClickHouse client (CLI).

  2. Select a database for operations you intend to perform.

    USE database-name
  3. Run the following query:

    ALTER TABLE table_name MOVE PARTITION partition_expr TO VOLUME 'default'

Your data has been moved to the SSD.

What's next