The "DB::Exception: Backup engine not found" error in ClickHouse occurs when a BACKUP or RESTORE command references a destination type that ClickHouse does not recognize. The BACKUP_ENGINE_NOT_FOUND error code means the specified backup engine name (such as Disk, S3, or File) is either misspelled, not supported in your ClickHouse version, or the required disk is not configured.
Impact
The backup or restore operation fails immediately without transferring any data. Your existing data and any previous backups remain unaffected, but you cannot proceed with the intended backup workflow until the destination is properly configured.
Common Causes
- The backup destination type is misspelled (for example,
Discinstead ofDisk) - The named disk referenced in
Disk('my_disk', ...)is not defined in the ClickHouse storage configuration - Using a backup engine that is not available in your ClickHouse version or build
- The S3 backup destination is used but the ClickHouse build does not include S3 support
- Missing or incorrect configuration in
storage_configurationfor the disk used as a backup target
Troubleshooting and Resolution Steps
Verify the correct syntax for the backup command. The supported destination types are
Disk,S3, andFile:BACKUP TABLE my_table TO Disk('backups', 'my_backup/');Check that the named disk exists in your storage configuration:
SELECT name, path, type FROM system.disks;If the disk named
backupsdoes not appear, you need to define it.Add a backup disk to your storage configuration (typically in
config.xmlor a file inconfig.d/):<clickhouse> <storage_configuration> <disks> <backups> <type>local</type> <path>/var/lib/clickhouse/backups/</path> </backups> </disks> </storage_configuration> <backups> <allowed_disk>backups</allowed_disk> <allowed_path>/var/lib/clickhouse/backups/</allowed_path> </backups> </clickhouse>For S3 backup destinations, ensure S3 is configured as a disk:
<disks> <s3_backups> <type>s3</type> <endpoint>https://my-bucket.s3.amazonaws.com/backups/</endpoint> <access_key_id>KEY</access_key_id> <secret_access_key>SECRET</secret_access_key> </s3_backups> </disks>Restart ClickHouse after adding disk configuration, then retry:
sudo systemctl restart clickhouse-serverVerify your ClickHouse version supports the backup engine you want to use:
SELECT version();The BACKUP/RESTORE functionality is available from ClickHouse 22.3 onward.
Best Practices
- Define a dedicated backup disk in your storage configuration and add it to the
allowed_disklist. - Use descriptive disk names like
backupsors3_backupsto make backup commands self-documenting. - Test your backup configuration in a non-production environment before relying on it for production data.
- Keep your ClickHouse version up to date to benefit from the latest backup engine improvements and bug fixes.
Frequently Asked Questions
Q: What backup destination types does ClickHouse support?
A: ClickHouse supports Disk (for local or remote disks defined in storage configuration), S3 (direct S3 syntax), and File (for local file paths, if allowed). The most common approach is to use Disk with a named disk.
Q: Can I back up directly to S3 without defining a disk?
A: In some ClickHouse versions, you can use BACKUP ... TO S3('https://bucket/path', 'key', 'secret'). However, defining an S3 disk in the configuration is more maintainable and keeps credentials out of SQL statements.
Q: Why does my backup work on one node but fail on another?
A: Each node needs the same disk configuration. If the backup disk is only defined on one node, other nodes will report BACKUP_ENGINE_NOT_FOUND. Ensure all nodes in the cluster share the same storage configuration.