External Disks for Storing Data
To work with data stored on disks use S3 table engine, and to work with data in the Hadoop Distributed File System — table engine.
ClickHouse supports zero-copy replication for S3
and HDFS
disks, which means that if the data is stored remotely on several machines and needs to be synchronized, then only the metadata is replicated (paths to the data parts), but not the data itself.
MergeTree and family table engines can store data to HDFS using a disk with type HDFS
.
Required parameters:
Optional parameters:
min_bytes_for_seek
— The minimal number of bytes to use seek operation instead of sequential read. Default value:1 Mb
.
You can encrypt the data stored on S3, or external disks, or on a local disk. To turn on the encryption mode, in the configuration file you must define a disk with the type encrypted
and choose a disk on which the data will be saved. An encrypted
disk ciphers all written files on the fly, and when you read files from an encrypted
disk it deciphers them automatically. So you can work with an disk like with a normal one.
For example, when ClickHouse writes data from some table to a file store/all_1_1_0/data.bin
to disk1
, then in fact this file will be written to the physical disk along the path /path1/store/all_1_1_0/data.bin
.
When writing the same file to disk2
, it will actually be written to the physical disk at the path /path1/path2/store/all_1_1_0/data.bin
in encrypted mode.
Required parameters:
type
—encrypted
. Otherwise the encrypted disk is not created.disk
— Type of disk for data storage.
path
— Path to the location on the disk where the data will be saved. If not specified, the data will be saved in the root directory.current_key_id
— The key used for encryption. All the specified keys can be used for decryption, and you can always switch to another key while maintaining access to previously encrypted data.algorithm
— Algorithm for encryption. Possible values:AES_128_CTR
,AES_192_CTR
orAES_256_CTR
. Default value:AES_128_CTR
. The key length depends on the algorithm:AES_128_CTR
— 16 bytes,AES_192_CTR
— 24 bytes,AES_256_CTR
— 32 bytes.
Example of disk configuration: