Secures ClickHouse data in transit and at rest by configuring TLS and encrypted disks.
Encryption defends sensitive analytics data against network sniffing and disk theft. By configuring TLS you protect client-server traffic. By storing tables on encrypted disks you safeguard data at rest, including backups.
Use OpenSSL or your PKI to create a server key, certificate, and CA bundle. Place the files under /etc/clickhouse-server/certs/ with strict 600 permissions.
Add a <tcp_port_secure>9000</tcp_port_secure> section inside config.xml and reference the certificate paths. Disable plaintext port if compliance demands.
Set protocol=tcp_secure or use clickhouse-client --secure --host db.example.com --port 9000.Libraries usually expose use_ssl=true parameters.
.
Add a disk entry of type encrypted inside storage_configuration, supply the path to the master key file, and specify the underlying volume.
Define a policy that points hot data to the encrypted disk, e.g. EncryptedPolicy.
Reference the policy in CREATE TABLE. All parts, mutations, and merges stay encrypted transparently.
Enable TLS whenever clients connect over public or shared networks. Use encrypted disks when storing personal data such as customer emails or when regulatory frameworks (GDPR, HIPAA) apply.
Rotate certificates yearly, monitor expiry, keep master keys in a dedicated KMS, disable insecure cipher suites, and test backup restores regularly.
TLS adds minimal overhead; benchmarks show <3 % latency increase over local networks.
Yes. Add a new key file, update the disk definition, perform ALTER TABLE ... MOVE PARTITION to re-encrypt, then remove the old key.
No. Data is compressed first, then encrypted, so storage savings remain.