Skip to main content

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

Moving data from Amazon Elastic Block Store (EBS) to object storage allows you to size down your EBS by selecting a service plan with less EBS capacity. You can move the data back to your EBS anytime.

You can transfer data between storage devices in Aiven for ClickHouse® using SQL statements against your tables directly.

Prerequisites

  • At least one Aiven for ClickHouse service
  • Command line tool (ClickHouse client) installed

Transfer data from EBS to object storage

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

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

  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 EBS to object storage when the EBS 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.

Transfer data from object storage to EBS

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

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

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

What's next

Related pages