Node/Docker tool to backup Clickhouse to S3/MinIO using builtin BACKUP TABLE.
Supports incremental backups.
CLICKHOUSE_URL='http://localhost:8123'
CLICKHOUSE_USER='default'
CLICKHOUSE_PASSWORD=''
CLICKHOUSE_DATABASE='default'
S3_ENDPOINT='http://localhost:9000'
S3_BUCKET='backups'
S3_ACCESS_KEY='minioadmin'
S3_SECRET_KEY='minioadmin'
BACKUP_INCREMENTAL=true
BACKUP_TABLES='table1,table2,other-db:table3'
node main.mjsFor all options see main.mjs.
- If incremental backups are disabled:
- Backups will be stored as
<S3_BUCKEt>/<database>/<table>.
- Backups will be stored as
- If incremental backups are enabled:
- The first backup will be stored as
<S3_BUCKET>/<database>/<table>/<timestamp>_full. - Incremental backups will be stored as
<S3_BUCKET>/<database>/<table>/<timestamp>. - Incremental backups will be based on the last (full or incremental) backup.
- The first backup will be stored as
<database>is determined by thedatabase:tableformat inBACKUP_TABLES, defaulting to the value ofCLICKHOUSE_DATABASE.<table>is determined by thedatabase:tableortableformat inBACKUP_TABLES.<timestamp>is the current timestamp inYYYY-MM-DD'T'HH-mm-ss.SSS'Z'format (ISO 8601 with:replaced by-). Example:2025-06-16T13.07.03.251Z.