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
-
Tiered storage feature enabled at project level
noteThis feature is in limited availability. Contact the sales team to enable it for your project.
-
Aiven organization
-
Command line tool (ClickHouse client)
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.
-
Connect to your Aiven for ClickHouse service using, for example, the ClickHouse client (CLI).
-
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.
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.
-
Connect to your Aiven for ClickHouse service using, for example, the ClickHouse client (CLI).
-
Select a database for operations you intend to perform.
USE database-name
-
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
- Check data distribution between SSD and object storage
- Configure data retention thresholds for tiered storage